On Nov 22, 7:06 am, Jari W.
[email protected] wrote:
<sub id="2>Some more data</sub>
# Some more stuff
The more I think about it, this kind of utility probably is required to
analyze the DTD rather than the XML to get the proper relationships. Any
such utility available?
I really have no idea how your XML file above maps to the output you
describe. It appears that you just look at the unique element names
and create classes from them. You ignore the hierarchy of the XML
file, you ignore all the attributes of the elements, and you ignore
all the text content of the elements?
So, you just need something like this:
raw_xml = IO.read( ‘myfile.xml’ )
all_tag_names = raw_xml.scan( /<(\w+)/ ).flatten.uniq
use ERB here to create new files using
tag_name.capitalize as the foundation for the class name