M
Markus Jais
hello
I am currently preparing an article about Ruby and XML where I will
show some XML modules for ruby. only a short example to show
people what's possible and that Ruby is a great alternative to Java/C#
when processing XML.
I am searching for a module where I can construct a Ruby Class from
an arbitrary XML document, similar to Python's anobind
with this I can take an XML document like this
<?xml version="1.0"?>
<birds>
<raptor wingspan='240cm'>
<english_name>White-tailed Eagle</english_name>
<german_name>Seeadler</german_name>
</raptor>
<raptor wingspan='80cm'>
<english_name>Kestrel</english_name>
<german_name>Turmfalke</german_name>
</raptor>
</birds>
and this python code
=============
#!/usr/bin/env python
import anobind
from Ft.Xml import InputSource
from Ft.Lib import Uri
file_uri = Uri.OsPathToUri('raptors.xml', attemptAbsolute=1)
input_source = InputSource.DefaultFactory.fromUri(file_uri)
binding = anobind.binder().read_xml(input_source)
print binding.birds.raptor[0].german_name.text_content()
print
for raptor in binding.birds.raptor:
print raptor.wingspan
print raptor.german_name.text_content()
print raptor.english_name.text_content()
print
============
is there something similar for ruby ?
thanks in advance
regards
Markus
I am currently preparing an article about Ruby and XML where I will
show some XML modules for ruby. only a short example to show
people what's possible and that Ruby is a great alternative to Java/C#
when processing XML.
I am searching for a module where I can construct a Ruby Class from
an arbitrary XML document, similar to Python's anobind
with this I can take an XML document like this
<?xml version="1.0"?>
<birds>
<raptor wingspan='240cm'>
<english_name>White-tailed Eagle</english_name>
<german_name>Seeadler</german_name>
</raptor>
<raptor wingspan='80cm'>
<english_name>Kestrel</english_name>
<german_name>Turmfalke</german_name>
</raptor>
</birds>
and this python code
=============
#!/usr/bin/env python
import anobind
from Ft.Xml import InputSource
from Ft.Lib import Uri
file_uri = Uri.OsPathToUri('raptors.xml', attemptAbsolute=1)
input_source = InputSource.DefaultFactory.fromUri(file_uri)
binding = anobind.binder().read_xml(input_source)
print binding.birds.raptor[0].german_name.text_content()
for raptor in binding.birds.raptor:
print raptor.wingspan
print raptor.german_name.text_content()
print raptor.english_name.text_content()
============
is there something similar for ruby ?
thanks in advance
regards
Markus