[XML-SIG] 0.6.4 problem with reading DOM tree from XML with validation

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat, 3 Mar 2001 09:08:27 +0100


Hi Scott,

Thanks for your comments and patches, they are quite helpful.

> *** xml/dom/ext/reader/Sax2.py-orig	Tue Feb 20 00:47:40 2001
> --- xml/dom/ext/reader/Sax2.py	Fri Mar  2 18:29:21 2001
> ***************
> *** 274,279 ****
> --- 274,281 ----
>       def __init__(self, validate=0, keepAllWs=0, catName=None,
>                    saxHandlerClass=XmlDomGenerator, parser=None):
>           self.parser = parser or (validate and sax2exts.XMLValParserFactory.make_parser()) or sax2exts.XMLParserFactory.make_parser()
> +         if validate:
> +             self.parser.setFeature (saxlib.feature_validation, 1)
>           if catName:
>               #set up the catalog, if there is one
>               from xml.parsers.xmlproc import catalog

I think the bug is actually in the XMLValParserFactory, which should
return a validating parser (which validation turned on).

> *** xml/parsers/xmlproc/xmlval.py-orig	Fri Mar  2 18:26:47 2001
> --- xml/parsers/xmlproc/xmlval.py	Fri Mar  2 18:26:53 2001
> ***************
> *** 98,105 ****
>       def parseEnd(self):
>           self.parser.parseEnd()
>   
> !     def read_from(self,file):
> !         self.parser.read_from(file)
>   
>       def flush(self):
>           self.parser.flush()
> --- 98,105 ----
>       def parseEnd(self):
>           self.parser.parseEnd()
>   
> !     def read_from(self,file,bufsize=16384):
> !         self.parser.read_from(file,bufsize)
>   
>       def flush(self):
>           self.parser.flush()

I've committed this as-is.

More later,
Martin