PyXML, Sax, error in processing external entity reference

David Dorward dorward at yahoo.com
Wed Feb 25 16:05:10 EST 2004


I'm attempting to read an XHTML 1.1 file[1], perform some DOM manipulation,
then write the results to a different file.

I've found myself rather stuck at the first hurdle.

I have the following:

from xml.dom.ext.reader import Sax2
reader = Sax2.Reader()
f = open('dorward.me.uk/sitemap.html', 'r')
doc = reader.fromStream(f)

(dorward.me.uk/sitemap.html being a local copy of
http://dorward.me.uk/sitemap.html)

... which outputs the following:

Traceback (most recent call last):
  File "x.py", line 4, in ?
    doc = reader.fromStream(f)
  File "/usr/lib/python2.3/site-packages/_xmlplus/dom/ext/reader/Sax2.py",
line 372, in fromStream
    self.parser.parse(s)
  File "/usr/lib/python2.3/site-packages/_xmlplus/sax/expatreader.py", line
109, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python2.3/site-packages/_xmlplus/sax/xmlreader.py", line
123, in parse
    self.feed(buffer)
  File "/usr/lib/python2.3/site-packages/_xmlplus/sax/expatreader.py", line
220, in feed
    self._err_handler.fatalError(exc)
  File "/usr/lib/python2.3/site-packages/_xmlplus/dom/ext/reader/Sax2.py",
line 340, in fatalError
    raise exception
xml.sax._exceptions.SAXParseException:
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-notations-1.mod:115:0:
error in processing external entity reference

I'm not sure where I should proceed from here. Is it a bug in my code? In
PyXML? In the DTD itself? What should I do next?

Thanks.

[1] Actually, lots of files, but one at a time.

-- 
David Dorward                                      <http://dorward.me.uk/>



More information about the Python-list mailing list