[XML-SIG] Working with non-compliant XML utilities

Alleman, Lowell lalleman at mfps.com
Wed Dec 10 16:02:29 EST 2003


Hi,

I'm working with an application that is very picky about the XML it accepts
(basically it's non-compliant).  The company's support team isn't giving me
many options.  Certain things that the XML spec say the parser shouldn't
care about, this utility cares about.  Things like the order of attributes
and whether an empty element is written as "<a></a>" or "</a>" need to be
presented in a specific way.

Any ideas on how to work around some of these issues.  Python XML tools
would be preferred, but at this point all ideas and/or tools are welcome.
All I need is to be able to dictate the order in which the attributes appear
and whether or not empty elements should be written using the shortcut
('<a/>') form.

The changes I am making to the XML document are rather trivial.  I've
considered simply using a slew of string.replace() and few regular
expressions to get job done, but there maybe a few cases where the DOM
approach would be preferable over the raw text manipulation approach.

FYI:  So far I have tried using minidom and 4DOM (the one from PyXML 0.8.2).
I haven't seen the flexibility that I require so far, but I'm not very
familiar with either parser.  minidom would be my preference, since it is
installed as part of the standard library.


Thanks in advance,

- Lowell Alleman




More information about the XML-SIG mailing list