[XML-SIG] minidom and validating parser error messages
Martin v. Loewis
Martin.v.Loewis@t-online.de
Wed, 17 Oct 2001 09:49:15 +0200
> parser = xml.sax.saxexts.XMLValParserFactory.make_parser()
[...]
> when i run the program, i always get an error:
>
> ...
> File "/usr/lib/python2.0/site-packages/_xmlplus/dom/pulldom.py", line 219,
> in
> reset
> self.parser.setFeature(xml.sax.handler.feature_namespaces, 1)
> AttributeError: 'SAX_XPValParser' instance has no attribute 'setFeature'
Hi Jan,
With the line above, you get a SAX1 driver; SAX1 did not provide the
setFeature operation, as used by pulldom. Instead of saxexts, you need
to use sax2exts.
> unfortunately, the documentation is *more than poor* (sorry guys).
We know; contributions are welcome.
> what is this "sax2exts" module used for ? when i tried that module for
> the parser generation, i noticed that there was a different error message
> (about a missing feed() method)
I see. Unfortunately, the xmlproc parser as shipped with PyXML 0.6.6
does not support "incremenental" operation, which is also required by
pulldom.
So it seems your options are the following:
- do not use a validating parser. Then, a plain
minidom.parse(sys.stdin) invocation will be sufficient.
- do not use minidom. The 4DOM builders support validation without
requiring an incremental parser. Use
xml.dom.ext.reader.Sax2.FromXmlStream(sys.stdin, validate=1)
- use the PyXML CVS code.
HTH,
Martin