[ python-Bugs-1698944 ] dtdparser discards last line

SourceForge.net noreply at sourceforge.net
Thu Apr 12 07:44:17 CEST 2007


Bugs item #1698944, was opened at 2007-04-11 22:44
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1698944&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: L. Peter Deutsch (lpd)
Assigned to: Nobody/Anonymous (nobody)
Summary: dtdparser discards last line

Initial Comment:
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).


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1698944&group_id=5470


More information about the Python-bugs-list mailing list