[XML-SIG] validate dom tree object

Leticia Larrosa LETICIA at tesla.cujae.edu.cu
Wed Apr 6 00:25:24 CEST 2005


Hi all:

I have to validate a dom tree but i can´t save it to a xml file.
I have been using the validating parser "xmlproc":
"
xml.parsers.xmlproc.xmlapp.DTDConsumer
xml.parsers.xmlproc.xmlapp.ErrorHandler
xml.parsers.xmlproc.xmlval
"
but i found that the function "create_input_source" in the following code 
that are placed in the module "xml.parsers.xmlproc.xmlapp": 
"
class InputSourceFactory:
    "A class that creates file-like objects from system identifiers."
    def create_input_source(self,sysid):
        if sysid[1:3]==":\\" or urlparse.urlparse(sysid)[0] == '':
            return open(sysid)
        else:
            return urllib2.urlopen(sysid)
"
don´t accept a instance of a xml dom tree.
I get the following error:
"
File "C:\Python23\Lib\site-packages\_xmlplus\parsers\xmlproc\xmlval.py", 
line 31, in parse_resource
self.parser.parse_resource(sysid)
File "C:\Python23\Lib\site-packages\_xmlplus\parsers\xmlproc\xmlutils.py", 
line 123, in parse_resource
infile = self.isf.create_input_source(sysID)
File "C:\Python23\Lib\site-packages\_xmlplus\parsers\xmlproc\xmlapp.py", 
line 224, in create_input_source
if sysid[1:3]==":\\" or urlparse.urlparse(sysid)[0] == '':
AttributeError: Document instance has no attribute '__getitem__'
"

My question is if exist a way of validate a xml dom tree object, not a xml 
file.
I accept any suggestions about other way of validate rather than "xmlproc".

Thanks in advance






More information about the XML-SIG mailing list