[XML-SIG] First cut at SAX tutorial

Andrew Kuchling akuchlin@cnri.reston.va.us
Wed, 20 May 1998 15:39:39 -0400 (EDT)


I've added some hastily-written tutorial material about SAX to the
current draft of the HOWTO; see http://www.python.org/doc/howto/xml/ .
No reference material yet, but I'll get around to it in the next day
or two, hopefully, and then revise the SAX tutorial; I want SAX
documented reasonably well before the first test release.

Since many users will pattern their code on what they see in the
tutorial, it's important that it not give them any bad habits, so
please be merciless in reporting things like suboptimal
implementation, or errors in terminology.

The organization isn't very optimal, but I'm not sure what the best
organization is.  It begins with startElement(), digresses to talk
about error handling, and then covers characters() and stopElement(),
which will probably be enough for many people.  Probably there should
be another subsection on other methods in the DocumentHandler
interface: endDocument() is the most important, since
ignorableWhitespace() and processingInstruction() seem most useful to
advanced users, who probably don't need a tutorial, and
setDocumentLocator() is for parser writers.  I'm not sure if there
should be a tutorial section on the DTDHandler interface; again, that
seems fairly advanced.

Something I'm not sure of: are there any cases where the user has to
perform entity substitution themselves, such as turning é into
the right character, or would any such XML parser be considered
broken?  (For example, what if it's not a standalone document, and the
parser doesn't read the DTD.  Wondering if I need to document how to
do that...)

-- 
A.M. Kuchling			http://starship.skyport.net/crew/amk/
Old friend, in my mind only do I write you this letter, but it is a splendid
letter, with perfect brushwork. Old hands do not shake or cramp when the
letter is written on the air.
    -- Master Li, in SANDMAN #74, "The Exile"