DTDParseError: failed to load external entity "NULL"

Bug #1105057 reported by Ulrich Seidl on 2013-01-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
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.

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
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  Edit
Everyone can see this information.

Other bug subscribers