This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pyexpat LexicalHandler swaps system_id and public_id
Type: Stage:
Components: XML Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: floerke, loewis
Priority: high Keywords:

Created on 2003-07-30 15:35 by floerke, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Messages (3)
msg17456 - (view) Author: Holger Floerke (floerke) Date: 2003-07-30 15:35
XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE A SYSTEM "a.dtd">
<A>test</A>

DTD: you can imagine

...
ch = MyHandler()
parser = make_parser()
parser.setProperty(handler.property_lexical_handler, ch)
...
class MyHandler(XMLGenerator):
...
    def startDTD(self, name, public_id, system_id):
        self._out.write(public_id)
...

-> "a.dtd" (but a.dtd should be the system_id) and the 
system_id in method startDTD is None

a glimpse into pyexpat.c from python 2.2.3 
...
VOID_HANDLER(StartDoctypeDecl,
...
STRING_CONV_FUNC,doctypeName,
              STRING_CONV_FUNC,sysid, 
STRING_CONV_FUNC,pubid,
              has_internal_subset))
...

maybe sysid and pubid is swapped.

I'm not a python specialist and maybe this bug is fixed or 
is not a bug. Please let me know...

HolgeR
msg17457 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-08-01 07:10
Logged In: YES 
user_id=21627

This is indeed a bug in Python 2.3, which has been fixed in
PyXML.
msg17458 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-05-06 01:56
Logged In: YES 
user_id=21627

This has been fixed in expatreader.py 1.33. Backporting the
fix to 2.3 is not possible, since applications may rely on
the bug.
History
Date User Action Args
2022-04-10 16:10:21adminsetgithub: 38972
2003-07-30 15:35:29floerkecreate