[XML-SIG] problem with parser.setFeature(feature_validation, 1)

Remy C. Cool dev-xml@smartology.nl
Tue, 17 Dec 2002 17:35:59 +0100

I have the following code:

from xml.sax import make_parser
from xml.sax.handler import feature_namespaces, feature_validation
from xml.sax.handler import ContentHandler, ErrorHandler, DTDHandler

class validation(ContentHandler):

   # create a parser
   parser = make_parser('xml.sax.drivers2.drv_xmlproc')
   # tell parser we are not interested in XML namespaces
   parser.setFeature(feature_namespaces, 0)
   # tell parser to enable validation
   parser.setFeature(feature_validation, 1)
   # create the handler
   valxml = validator()
   # tell the parser to use our handler
   # Parse the input
When I use this ... the parser validates, but closing tags are not 
processed with the endElement(self, name) function in the class 
validator. When I remove the feature_validation line or set it to 0 
... I don't get a validation error: Element 'tag' not declared
when I use the following xml

<tag>This is a test</tag>

Is this normal behaviour ?

Remy Cool