[XML-SIG] problem with validating parser
Alexandre Fayolle
alexandre.fayolle@free.fr
Fri, 04 Aug 2000 09:38:01 +0200 (MEST)
Hello,
I'm trying to use the validating parser, and I run into a problem. However, I
don't think that my document is invalid. Could someone help me, please ?
the code :
from xml.dom.ext.reader import Sax2
tree = Sax2.FromXmlFile('MainFrame.xml',validate=1)
The document :
<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<!DOCTYPE frame SYSTEM "./frame.dtd">
<frame>
</frame>
I have a file called frame.dtd in the current directory.
The stack trace I get :
[alf@leo alui]$ python Utils.py
Traceback (innermost last):
File "Utils.py", line 73, in ?
tree = Sax2.FromXmlFile('MainFrame.xml',validate=TRUE)
File "/home/alf/xmlSig/repository/xml/xml/dom/ext/reader/Sax2.py", line 266,
in FromXmlFile
rv = FromXmlStream(fp, ownerDocument, validate, keepAllWs, catName,
saxHandlerClass)
File "/home/alf/xmlSig/repository/xml/xml/dom/ext/reader/Sax2.py", line 246,
in FromXmlStream
parser.parseFile(stream)
File "/home/alf/xmlSig/repository/xml/xml/sax/drivers/drv_xmlproc.py", line
39, in parseFile
self.parser.read_from(file)
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlval.py", line
102, in read_from
self.parser.read_from(file)
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlutils.py", line
137, in read_from
self.feed(buf)
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlutils.py", line
185, in feed
self.do_parse()
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlproc.py", line
101, in do_parse
self.parse_doctype()
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlproc.py", line
504, in parse_doctype
sys_id))
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlutils.py", line
77, in parse_resource
self.read_from(infile,bufsize)
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlutils.py", line
137, in read_from
self.feed(buf)
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlutils.py", line
185, in feed
self.do_parse()
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/dtdparser.py", line
249, in do_parse
self.parse_elem_type()
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/dtdparser.py", line
525, in parse_elem_type
self.report_error(3004,("EMPTY, ANY","("))
File "/home/alf/xmlSig/repository/xml/xml/parsers/xmlproc/xmlutils.py", line
372, in report_error
self.err.fatal(msg)
File "/home/alf/xmlSig/repository/xml/xml/sax/drivers/drv_xmlproc.py", line
96, in fatal
self.err_handler.fatalError(saxlib.SAXParseException(msg,None,self))
File "/home/alf/xmlSig/repository/xml/xml/dom/ext/reader/Sax2.py", line 226,
in fatalError
raise exception
xml.sax.saxlib.SAXParseException: One of EMPTY, ANY or '(' expected at
Unknown:2:42
Column 42 is just after the closing '>' on line 2, I cannot see why I should
open a bracket or put EMPTY or ANY at this point of my file. What am I missing ?
Thanks for your help.
Alexandre Fayolle