Re: Modules for Python writng to XML

Date : Fri, 27 Oct 2006 10:10:08 +1000
To : XSI(at)Softimage.COM
From : "Aloys Baillet" <aloys.baillet(at)gmail.com>
Subject : Re: Modules for Python writng to XML
Hi Andre,

minidom is the slowest ever way of getting XML in Python... Even slower than Microsoft XML parsing for JScript...
Regarding the size of the XML, you should have a closer look at cElementTree (the fastest) or lxml, less fast but more powerful.

Just my 2 cents...


Aloys

On 10/27/06, Andre DeAngelis <andre.deangelis@ubisoft.com > wrote:

Thanks Francois, Patrick and Steven,

 

This is a big help.

 

Andre

 


From: owner-xsi@Softimage.COM [mailto:owner-xsi@Softimage.COM] On Behalf Of FranÃois Painchaud
Sent: October 26, 2006 1:05 PM
To: XSI@Softimage.COM
Subject: Re: Modules for Python writng to XML

 

Hi Andre,

Module xml.dom.minidom does a fine job.
For example, to parse and save back an XML file:

    import xml.dom.minidom
   
    oSceneTOCDoc = xml.dom.minidom.parse( sSceneTOCPath )
   
    # Do your XML stuff with oSceneTOCDoc here.
   
    oSceneTOCFile = open( sSceneTOCPath, "w" )
    oSceneTOCDoc.writexml( oSceneTOCFile )
    oSceneTOCFile.close()

For references, see:
    http://docs.python.org/lib/module-xml.dom.minidom.html
    http://www.oreilly.com/catalog/pythonxml/index.html
    http://softimage.wiki.avid.com/index.php/XML_%28XSISDK%29

FranÃois

-------- Message original --------

Sujet:

Modules for Python writng to XML

Date:

Thu, 26 Oct 2006 11:53:07 -0400

De:

Andre DeAngelis <andre.deangelis@ubisoft.com>

Pour:

<XSI@Softimage.COM>

 

Hello Python Gurus out there
 
I am porting an old script from jscript to python for exporting cluster
data to XML.
 
There seems to be more than one XML module for Python, so I was
wondering if here were any recommendations which to use.  
 
If anyone could share an example of it in use, that of course would be
very much appreciated.

 
Andre 



--
Aloys Baillet - XSI Technical Director
Character Dpt - Animal Logic
--

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.