[XML-SIG] Working with non-compliant XML utilities
Alexandre Fayolle
Alexandre.Fayolle at logilab.fr
Fri Dec 12 07:27:14 EST 2003
On Wed, Dec 10, 2003 at 04:02:29PM -0500, Alleman, Lowell wrote:
> 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.
A way to getting what you need could probably be to use SAX to
translate the document you have to what your appplication will
understand. Get the content handler to produce the text representation
of the contents read by the parser seems feasible.
Some code to start from can be found in xml.sax.writer. The startElement
and endElement should be customized to produce attributes in the right
order, and to close elements correctly.
The complexity of the task will depend on the genericity you want to
achieve, of course.
--
Alexandre Fayolle
LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
Développement logiciel avancé - Intelligence Artificielle - Formations
More information about the XML-SIG
mailing list