[XML-SIG] xml.sax.writer

Fred L. Drake, Jr. fdrake@acm.org
Wed, 24 Nov 1999 14:19:59 -0500 (EST)


  I've just checked in the xml.sax.writer module, which defines a
couple of SAX DocumentHandler-protocol classes that can be used to
generate XML output.  There are two primary classes:

    XmlWriter -- basic XML generation
    PrettyPrinter -- adds nice indentation

  There are a number of supporting classes as well, that I'll document 
over the next couple of weeks, and hopefully provide an example.  I'll 
also update demos/genxml/loaddata.py to use the PrettyPrinter class,
which is closest to the intent.
  The helper classes call into two categories: syntax descriptions and 
DTD descriptions.  The syntax descriptions can be used to control
whether the output of the output drivers is XML-like, SGML-like, or
XHTML-like (with that stupid extra space in front of />).  You could
do even more damage with them, but let's not go there!  ;-)
  The DTD description objects can be used to provide information about 
the output DTD to the writers; it can be very nice to know things like 
which elements allow #PCDATA and which are empty.  You can initialize
these objects either by calling methods to set up specific elements or 
(for the XML/XHTML variants) by calling a method to parse the DTD
using xml.parsers.xmlproc.dtdparser.  I'll make this stuff easier as
well in the future with some handy convenience functions.
  It would be really nice to have an SGML DTD parser as well.  ;-)


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives