[XML-SIG] need help: Sax can't read w3 dtds?

Luke Bradley webworldl at yahoo.com
Thu Aug 5 22:21:56 CEST 2004


Hi, I  am looking for help with processing XTHML
documents in python with SAX or DOM. If this is not
the right place to ask, could you please refer me to a
good place?

My problem is that when I try to parse XHTML1.1
documents with pythons SAX implementation, it throws
an error claiming that there are errors in the W3C's
DTD's. given an XHTML page generated by the W3's TIDY
generator called hello.html:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator" content=
      "HTML Tidy for Windows (vers 1st June 2004), see
www.w3.org" />
    <meta http-equiv="Content-Type" content=
      "text/html; charset=us-ascii" />
    <title>Hello World</title>
  </head>
  <body>
    <p>Hello World!</p>
  </body>
</html>

and the python code:

import xml.sax.handler
xml.sax.parse("hello.html",
    xml.sax.handler.ContentHandler()
              )

a fatal error occurs with the following stacktrace:

Traceback (most recent call last):
  File "D:/projects/pyper/saxtest.py", line 4, in
-toplevel-
    xml.sax.handler.ContentHandler()
  File
"D:\PYTHON23\Lib\site-packages\_xmlplus\sax\__init__.py",
line 31, in parse
    parser.parse(filename_or_stream)
  File
"D:\PYTHON23\Lib\site-packages\_xmlplus\sax\expatreader.py",
line 109, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File
"D:\PYTHON23\Lib\site-packages\_xmlplus\sax\xmlreader.py",
line 123, in parse
    self.feed(buffer)
  File
"D:\PYTHON23\Lib\site-packages\_xmlplus\sax\expatreader.py",
line 220, in feed
    self._err_handler.fatalError(exc)
  File
"D:\PYTHON23\Lib\site-packages\_xmlplus\sax\handler.py",
line 38, in fatalError
    raise exception
SAXParseException:
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-framework-1.mod:89:0:
error in processing external entity reference

any ideas? am I missing something basic? thanks.






		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 


More information about the XML-SIG mailing list