2

I'd like to know how I can serialize an XML document in python specifically using the xml.dom library.

1 Answer 1

1

You mean something like:

xml.dom.ext.PrettyPrint(doc, open(name, "w"))

where doc is the XML document and name is the name of the file?

Or, if you have xml.dom.minidom, how about the xml.dom.minidom.writexml function?

Sign up to request clarification or add additional context in comments.

5 Comments

The xml.dom.ext module doesn't seem to be a part of the standard library. Where does this library come from?
This is part of the PyXML package, not standard Python libraries.
It seems that PyXML is no longer maintained, according to a note on their download page on sourceforge: sourceforge.net/projects/pyxml/files Is there a way to do this that uses a library that is maintained?
Regarding minidom, it strangely does not support serialization of namespaces: untidy.net/blog/2006/03/03/… This is rather important for my application.
Thanks for trying, I appreciate it. I've spun off a new question to address what I feel may be the more general problem: stackoverflow.com/questions/4005641/is-python-bad-at-xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.