DTDParseError: failed to load external entity "NULL"

Bug #1105057 reported by Ulrich Seidl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Confirmed
Low
Unassigned

Bug Description

Loading a DTD from a path containing a space fails. E.g.:

lxml.etree.DTD( "/tmp/a b.dtd" )

will lead to:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "dtd.pxi", line 297, in lxml.etree.DTD.__init__ (src/lxml/lxml.etree.c:143528)
lxml.etree.DTDParseError: failed to load external entity "NULL"

Doing:
fd=open( "/tmp/a b.dtd", "r" )
lxml.etree.DTD( fd )
fd.close()

works as expected. Parsing an xml file like with lxml.etree.parse( "/tmp/a b.xml" ) works, too.

Revision history for this message
scoder (scoder) wrote :

Right, only URLs are supported here. Thus, "file:///tmp/a b.dtd" works, but a plain file name does not. It should.

Changed in lxml:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
scoder (scoder) wrote :

Funny enough, URL escaping works here, i.e.

lxml.etree.DTD( "/tmp/a%20b.dtd" )

I don't think that's generally a good thing, however unless the path really *is* a URL. People might actually have deliberately used a "%" in their file name...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.