removing ignorable whitespace from minidom.DOM

haughki hawkeye.parker at autodesk.com
Wed Oct 8 13:43:40 EDT 2003


apologies for asking this.  it must have been answered before.  i have
really tried to find the answer elsewhere.

a simple question:  i'd like to remove all ignorable whitespace from
my minidom representation.  it make the DOM much cleaner (for me).

i've resorted to parsing first with Sax2 and using StripXml to deal
with the whitespace.  why not stick with the Sax2 DOM you ask?  legacy
code all uses the minidom, and they're not *quite* compatible.

unfortunately, the Sax2 parser moves all of my (very intentional)
namespace declarations to the document level, which causes me yet
another headache).  if anyone here happens to know how to *stop* the
Sax2 reader from mucking up my namespaces, that would be nice to know
too.  of course, i'm sure the mucking is done for another Very
Important Reason.  it's still mucking to me.

in a better world, i'd vow my lifelong service to anyone who can help
with these questions.  in ours, i'll say:  thanks in advance ; )

haughki




More information about the Python-list mailing list