[XML-SIG] Bug: XML Prolog from xml.sax.writer should contain version

Radestock, Guenter guenter.radestock@sap.com
Tue, 13 Feb 2001 11:28:53 +0100


The xml.sax.writer in 0.6.3 (and previous) will output a prolog like

<?xml encoding="iso-8859-1"?>

this is incorrect, according to the XML 1.0 specification and will
not be parsed by expat.  When outputting an encoding, the writer
must also say an XML version number.  I changed the code in 
sax/writer.py (unfortunately, I don't have diff available here):

    def startDocument(self):
        if self.__syntax.pic == "?>":
            lit = self.__syntax.lit
            s = '%sxml version="1.0" encoding%s%siso-8859-1%s' % (
                self.__syntax.pio, self.__syntax.vi, lit, lit)
            if self.__standalone:
                s = '%s standalone%s%s%s%s' % (
                    s, self.__syntax.vi, lit, self.__standalone, lit)
            self._write("%s%s\n" % (s, self.__syntax.pic))

please anybody fix this on sourceforge so it will be OK in the
next release.

- Guenter