[XML-SIG] 0.5.1 and 0.6.2
Martin v. Loewis
Fri, 1 Dec 2000 00:47:39 +0100
> Well, I was using DOM (a file gets processed, then the tree gets
> traversed, needed information obtained, and the result file gets
In that case, it will be difficult to come up with code that works
identical for both versions. In PyXML 0.5, there was a single DOM
implementation; let's call it PyDOM. Instances of Document nodes where
created using a Builder instance.
In PyXML 0.6, there are two DOM implementations: minidom and 4DOM;
minidom is also provided in Python 2. A minidom instance is created
using xml.dom.minidom.parse[String]. A 4DOM instance is created using
Once you have a Document, processing it should be identical between
all those DOM implementations - that is what the DOM standard provides.
Finally, generating back XML varies among implementations. minidom's
Node provides a toxml method; 4DOM offers xml.dom.ext.[Pretty]Print;
PyDOM had xml.dom.writer.XMLWriter and derived classes.
So if you need code that works with both versions, you probably need
to conditionalize, and unify interfaces for your needs:
domversion = "PyDOM"
domversion = "4DOM"
if domversion = "PyDOM":
builder = xml.dom.sax_builder.SaxBuilder()
parser = xml.sax.saxexts.make_parser()
io = StringIO(str)
elif domversion = "4DOM":
Likewise, you could wrap output generation.
Hope this helps,