[XML-SIG] setFeature(feature_validation, 1) causes misfire on endElement()

Remy C. Cool dev-xml@smartology.nl
Fri, 6 Dec 2002 15:35:33 +0100


On Friday 06 December 2002 13:53, Martin v. L÷wis wrote:

> "Remy C. Cool" <dev-xml@smartology.nl> writes:

> > When feature_validation is set to true ... the endElement handler
> > does not work. When feature_validation is set to false,
> > endElement works and validation is still enabled.
>
> What do you mean by "does not work"?

When the above feature is set to 1 (true)  the parser does not call 
the  endElement(self) function. 

Example code:

class myParser(ContentHandler):
	def __init__(self):
		pass

	def startElement(self, name):
		print 'start:', name
	
	def endElement(self, name):
		print 'end:', name
  

With feature_validation set to false (o) or removing the line 
completely ... the result is:

start: taga
start: tagb
end: tagb
end: taga

With feature_validation set to true (1) the result is:

start: taga
start: tagb

> > An other problem (not related) is that the locator function:
> >
> > def setDocumentLocator(self, locator):
> >       self.locator = locator
> >
> > doesn't work
>
> Again, what do you mean by "doesn't work"?

Example code:

class myParser(ContentHandler):
	def __init__(self):
		pass

	def setDocumentLocator(self, locator):
		self.locator = locator

	def startElement(self, name):
		print 'start:', name
		print self.locator.getLineNumber()
	
	def endElement(self, name):
		print 'end:', name
		
Running the above results in a self.locator does not have the property 
getLineNumber() error.

Regards, 
Remy Cool