[XML-SIG] [ pyxml-Bugs-696087 ] DocumentType: systemId/publicId swapped

SourceForge.net noreply@sourceforge.net
Sun, 02 Mar 2003 08:53:33 -0800


Bugs item #696087, was opened at 2003-03-02 17:53
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=696087&group_id=6473

Category: SAX
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jens Quade (snejsource)
Assigned to: Nobody/Anonymous (nobody)
Summary: DocumentType: systemId/publicId swapped 

Initial Comment:
Using the non-validating DOM reader, the Public/System Identifier in the DocType element got swapped.

==================

Demo (uses DOM, because I encountered the problem using xml.dom.ext.reader.Sax2):


>>> x="""
... <!DOCTYPE p PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
...              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
... <p>foo</p>
... """

>>> from xml.dom.ext.reader.Sax2 import FromXml


>>> dom=FromXml(x)
>>> dom.doctype.publicId
>>> u'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
>>> dom.doctype.systemId
u'-//W3C//DTD XHTML 1.0 Transitional//EN'

>>> dom=FromXml(x,validate=1)
>>> dom.doctype.publicId
u'-//W3C//DTD XHTML 1.0 Transitional//EN'
>>> dom.doctype.systemId
u'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'


====================

Bug hunting:

The pyexpat reader implements start_doctype_decl with wrong parameter order:

def start_doctype_decl(self, name, pubid, sysid, has_internal_subset):
        self._lex_handler_prop.startDTD(name, pubid, sysid)

in expatreader.py 

vs.

/* This is called for the start of the DOCTYPE declaration, before
   any DTD or internal subset is parsed.
*/
typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
                                            const XML_Char *doctypeName,
                                            const XML_Char *sysid,
                                            const XML_Char *pubid,
                                            int has_internal_subset);


====================


After swapping pubid/sysid in the start_doctype_decl parameter list of _xmlplus/sax/expatreader.py , the problem was gone.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=696087&group_id=6473