XML doc generation
Jonathan Pennington
john at coastalgeology.org
Mon Jan 22 20:54:36 EST 2001
I need some XML help. Here's a snippet from the XML How-To:
<snip>
You can also construct a DOM tree yourself, and convert it to XML;
this is often a more flexible way of producing XML output than simply
writing <tag1>...</tag1> to a file.
<snip>
Unfortunately, I can't find an example of this.
Does anyone have some code(script?) I can read that does this so I can
learn? Much of what I see in docs/archives is parsing of an XML
document. I, however, have long strings of coordinate data and info
that I currently parse into a large nested dictionary. I'd like to be
able to convert this into an XML format instead of or in addition to a
dictionary.
Thanks,
-J
---- problem example for the more curious ----
I have a string returned as this just to ease splitting of multiple data
types (ie. some have more or less info than this):
"name:V:WAYPNT:R:comment:V:Test Waypoint data:R:latitude:V:-345689284304 \
:R:longitude:V:948502987435:R:proximity:V:83:R:symbol:V:8345:R:display:V:0"
I don't have a DTD finished yet, but would like something like this, I
just don't want to manually add the tags all the time (ie. I'll
generate them based on the dictionary's "has key" membership):
<DataSet type="coordinate"> .... Also mineral, lithologic, etc.
<CoordinateSet type="waypoint"> Also route, track, group, etc.
<datapoint number="gh456"> Unique identifier for each
<name>WAYPNT</name>
<comment>Test Waypoint Data</comment>
<coordinates>
-0893274924,0928093840
</coordinates>
<proximity type="waypoint" location="gh455">
83
</proximity>
<symbol>8345</symbol>
<display>0</display>
</datapoint>
</CoordinateSet>
</DataSet>
--
Jonathan Pennington | http://coastalgeology.org
Site Manager | Protection and stewardship
CoastalGeology.Org (CGO) | through public education.
john at coastalgeology.org | Join CGO, make a difference.
More information about the Python-list
mailing list