[XML-SIG] How to parse an XML in SAX
stefan_ml at behnel.de
Mon Nov 12 17:43:08 CET 2007
Alexandro Colorado wrote:
> On Mon, 12 Nov 2007 05:06:56 -0600, Stefan Behnel <stefan_ml at behnel.de>
>> Alexandro Colorado wrote:
>>> Thanks for selling me into ElementTree however I cant because the
>>> version of the Python distribution that is being shipped doesn't has
>>> element tree so this make this a particular situation that I can only
>>> used the standard libraries.
>> I'm not sure I understand this. You are writing Python code, right? Why
>> you just add another Python source file? (such as ElementTree.py)
> Well first of, will it be backward compatible with 2.3?
AFAIR, it works on Python 1.5.2 and later.
> How can I include it on the fly without modifying the base install?
By copying the file next to your own code?
> What's wrong with SAX, aside from this whitespace issue I already have the
> parsing I want. Plus SAX is not just a python thing I might need SAX for
> other languages.
No problem, go ahead. Since you already have an implementation, you probably
have solved enough problems already, you'll solve the remaining ones also.
> SAX is a very quick parser from what I've read.
SAX is not a parser. It uses a parser in the background to generate SAX parse
events (which IMHO are pretty ugly to work with, but that's what you wanted).
> is there a way I can escape the non-printable characters
Tried repr() ? (or "%r" for what it's worth...)
More information about the XML-SIG