XML doc generation

Jerome Alet alet at unice.fr
Tue Jan 23 04:36:39 EST 2001


Jonathan Pennington wrote:
> 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.

I suggest you to download my XML generation module jaxml from:

http://cortex.unice.fr/~jerome/jaxml

the latest version is 1.22

with this module generating XML has never been more easy:

>>> import jaxml
>>> myxmldoc = jaxml.XML_document()
>>> myxmldoc.DataSet(type="coordinate")
>>> myxmldoc.CoordinateSet(type="waypoint")
>>> myxmldoc.datapoint(number="gh456")
>>> myxmldoc.name("WAYPNT")
>>> myxmldoc._output()                

Gives:

<?xml version="1.0" encoding="iso-8859-1"?>
<DataSet type="coordinate">
    <CoordinateSet type="waypoint">
        <datapoint number="gh456">
            <name>
                WAYPNT
            </name>
        </datapoint>
    </CoordinateSet>
</DataSet>

Hoping this will help.

-- 
Jerome Alet - alet at unice.fr - http://cortex.unice.fr/~jerome
Fac de Medecine de Nice        http://wwwmed.unice.fr 
Tel: (+33) 4 93 37 76 30     Fax: (+33) 4 93 53 15 15
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE



More information about the Python-list mailing list