[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-xml-sig
Subject:    [XML-SIG] setFeature(feature_validation, 1) causes misfire on endElement()
From:       dev-xml () smartology ! nl (Remy C !  Cool)
Date:       2002-12-06 14:35:33
Message-ID: 200212061535.33271.dev-xml () smartology ! nl
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic