[XML-SIG] no 'writexml' when building a domTree from ext.Sax2
aconrad.tlv at magic.fr
Mon Jul 26 16:54:56 CEST 2004
My idea here is to :
1- read an xml file
2- make modifications to it (delete nodes)
3- save it back to a file
The way I build my DOM tree is with :
from xml.dom.ext.reader import Sax2
doc = playlist.xml
# Create Reader object
reader = Sax2.Reader()
# Parse the document
xmldoc = reader.fromStream(doc)
1- That's how they do it in the manual. So now, I have a dom tree. Good.
2- Now, I can traverse and manipulate my tree using a treeWalker. Good.
3- ... But now, I'm having trouble writing my document back to an XML file.
Before, I used to generate XML files with doc.writexml(f) when doc was
created with 'doc = xml.dom.minidom.Document()'. But now, I have a dom
tree from the ext.Sax2.Reader() but I can't 'writexml'.
Shouldn't that 'writexml' method be there ? I need to be able to write
an XML file without all the indentation and newline stuff.
Also, I'm curious how I can tell Sax2.Reader() to ignore indentations
and newlines when reading from a pretty printed document.
Alexandre CONRAD - TLV
Research & Development
tel : +33 1 30 80 55 05
fax : +33 1 30 56 55 06
6, rue de la plaine
78860 - SAINT NOM LA BRETECHE
More information about the XML-SIG