[XML-SIG] Where is the xml.dom.ext package in current pythondistributions? .ext documentation?

Anastasios Hatzis ah at hatzis.de
Wed Feb 7 13:53:07 CET 2007


Martin v. Löwis wrote:
> Anastasios Hatzis schrieb:
> 
>>> Parts of PyXML were integrated into Python 2.0, namely xml.dom,
>>> xml.sax, and pyexpat. Other parts were never considered for inclusion,
>>> for various reasons.
>>>
>>
>> Martin, thank you for your notice. I wonder if the mentioned parts are 
>> developed as "forks". Do you know if there are any differences between 
>> those parts in recent Python and in PyXML distributions?
> 
> When I still maintained PyXML, I kept the Python copy and the PyXML
> copy of the code synchronized. Now that PyXML is not maintained anymore,
> the Python copy is more recent. This primarily means that it has more
> bugs fixed.
> 

Good to know for migration. The reason for switching to Python is just 
to reduce system requirements of my tool. The prototype works fine with 
PyXML, though.

Is the xml.dom entirely -with all subpackages/modules- available under 
the same package in Python? Currently I use from PyXML particularily 
these features:

# (1) for reading/parsing data from XML:
from xml.dom.ext.reader import Sax2

# (2) for building/manipulating DOM tree:
from xml.dom.DOMImplementation import implementation

# (3) for serializing data to XML:
from xml.dom.ext import PrettyPrint

AFAIK, I can replace (2) with the respective features in Python, seem to 
have still the same structure and names, at least those I use.

I guess (3) can be replaced by a to_xml() method (?) I noticed 
somewhere, but I need to look again.

There is just (1) which leaves me with some doubt and head-ache what to 
do. I wonder which Python lib would be the appropriate replacement for 
the Sax2 reader. Nota bene, that I was confused by the name "SAX" since 
I use it as described here:

http://pyxml.sourceforge.net/topics/howto/node18.html

in order to get a DOM tree from the XML file which I can than walk 
through - I don't care the events... but I thought SAX is 
event-driven?!? However, I need to switch to a tree-based XML parser 
alternative on Python distribution.

Regards,
Anastasios


More information about the XML-SIG mailing list