XML documentation stinks - help?
Brian Quinlan
brian at sweetapp.com
Wed Sep 1 07:11:19 EDT 2004
Simon John wrote:
> No, that's the docs I'm talking about, it's awful IMO.
I don't disagree. However, the W3 defines a lot of vocabulary for
talking about XML and learning that is probably the first step in
learning XML in any language.
> So far I've found a little bit of info on the xml.parsers.expat module,
> and got the following working the way Perl does, but it seems to create
> blank elements due to whitespace!
What is a blank "element"? Do you mean a text node containing only
whitespace?
> And it seems the expat module has been deprecated in favour of SAX?
Expat provides a SAX stream. You said the equivalent of "BMWs are being
depreciated in favour of cars".
> # create parser
> prs = xml.parsers.expat.ParserCreate()
>
> # start handler
> prs.StartElementHandler = startHandler
>
> # end handler
> prs.EndElementHandler = endHandler
>
> # char handler
> prs.CharacterDataHandler = charHandler
Subclassing is probably a more logical way to do this.
Cheers,
Brian
More information about the Python-list
mailing list