xml sax

Timothy Wu 2huggie at gmail.com
Wed Mar 19 12:43:17 CET 2008


Hi,

I am using  xml.sax.handler.ContentHandler to parse some simple xml.

I want to detect be able to parse the content of this tag embedded in the
XML.

<Id>174</Id>

Is the proper way of doing so involving finding the "Id" tag
from startElement(), setting flag when seeing one, and in characters(),
when seeing that flag set, save the content?

What if multiple tags of the same name are nested at different levels
and I want to differentiate them? I would be setting a flag for each level.
I can imagine things get pretty messy when flags are all around.

Timothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080319/e1eb927f/attachment.html>


More information about the Python-list mailing list