[XML-SIG] Error using xml.sax.{xmlreader,expatreader}

Mike Orr iron@mso.oz.net
Tue, 28 Nov 2000 22:24:04 -0800

On Tue, Nov 28, 2000 at 08:02:49AM +0100, Martin v. Loewis wrote:
> Apparently, you've been looking at an old version of the HOWTO. Where
> did you find that version?

www.python.org, "Documentation", "Topic Guides", XML, XML HOWTO.  I printed
it November 18.  But it looks like it doesn't matter now; I looked today
and the pages have been reorganized.

BTW, today http://www.python.org/topics, "XML" link goes to 
http://pyxml.sourceforge.net/topics/ (the same page) via a redirect,
then clicking the "XML" link again produces 
"The requested URL /topics/xml/ was not found on this server."

I did find the new HOWTO today under www.python.org/doc/, "HOWTO documents".
Yes, the methods and package names are quite different from the HOWTO I had,
and this one says "This howto describes version 2 of SAX..." at the beginning
of the SAX section.

* * * * *
> > Are there plans to document XMLGenerator?  
> Please have a look at
> http://www.python.org/doc/current/lib/module-xml.sax.saxutils.html
> and let me know which specific information did you expect to see that
> isn't there.

OK, I didn't understand the entire SAX section in the Library manual; that's
why I was following the example in the HOWTO.  The manual explains what each
function/class/method/constant is, but it doesn't say which few are the most
inportant for somebody wanting to parse a simple document.  Adding an example
would make a world of difference.  Even taking the comic-book example from the
HOWTO, or saying "look in the HOWTO for examples" would help.

How about the little program I posted?  Could it not be the basis of an example
if it were shorter, had the errors removed, used xml.sax.parser(), and printed
the keys/values as it puts them into the dictionary?  I can write something up
if somebody wants to be an "expert reviewer".

* * * * *
Regarding XMLGenerator, again, an example would make a world of difference.
Reading the following paragraph, I did not get any indication that this is the
class I should use to convert my data structure to XML.  "This class implements
the ContentHandler interface by writing SAX events back into an XML document."
Great, but I have a list of dictionaries, not SAX events, and I don't care
about SAX per se, I just want to get the data written somehow.  "In  other
words, using an XMLGenerator as the content handler will reproduce the original
document being parsed."  What!?  Why would anybody want to "reproduce" the XML
document they had just read in?  They already have it.

Looking at the source, I can see I can use it as a standalone class to write
my XML file, but I would have never guessed that from the Library reference,
much less known how to use it.

Shall I write up an example for that too?

> Indentation is a hard problem: Adding whitespace may modify the
> meaning of the document, depending on the
> DTD. xml.sax.writer.PrettyPrinter does indentation; this is a SAX1
> DocumentHandler, though.

Hmm, the example better mention which whitespace is significant for that
DTD, then.

-Mike (Iron) Orr, iron@mso.oz.net  (if mail problems: mso@jimpick.com)
   http://mso.oz.net/     English * Esperanto * Russkiy * Deutsch * Espan~ol