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: dtdparser discards last line
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: loewis, lpd
Priority: normal Keywords:

Created on 2007-04-12 05:44 by lpd, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg31765 - (view) Author: L. Peter Deutsch (lpd) Date: 2007-04-12 05:44
The DTD parser in xml.parsers.xmlproc.dtdparser sometimes simply ignores the last line of the input file. Here is the Python program I used to test it:

------begin
from xml.parsers.xmlproc.dtdparser import DTDParser,\
 DTDConsumer, DTDConsumerPE
import tracer

def parse_dtd(dtd):
    parser = DTDParser()
    handler = DTDConsumerPE()
    parser.set_dtd_consumer(handler)
    parser.feed(dtd)

tracer.trace(DTDConsumer)

parse_dtd('''\
<!ENTITY % score PUBLIC

	"-//Recordare//ELEMENTS MusicXML 1.1 Score//EN"

	"t.dtd">

%score;



''')
------end

where the file t.dtd contained:

------begin
<!ELEMENT opus EMPTY>
------end

The tracer package (my own code) indicated that the opus element was never parsed. The same was true if I added a blank line after the %score; entity reference. However, if I added *two* blank lines after the entity reference, the element declaration *was* processed.

I would note that while the bug exists in the original xmlproc package (at least in xmlproc 0.70, downloadable from http://www.garshol.priv.no/download/software/xmlproc/), the bug does *not* exist in the PyXML package (downloadable from http://sourceforge.net/projects/pyxml).
msg31766 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-04-14 19:08
xmlproc is not part of the Python release; instead, it is part of PyXML. Closing this report as third-party.

Alas, PyXML is not maintained anymore, so bugs in xmlproc are unlikely to get fixed.
History
Date User Action Args
2022-04-11 14:56:23adminsetgithub: 44834
2007-04-12 05:44:17lpdcreate