In my last email i have an error in the following two lines: " xv.parse_resource(xml_fileIO) domTree = FromXmlStream(xml_fileIO) " because i must to do a deep copy of the StringIO object first, because the "xv.parse_resource" close the file. The code must be: " xml_fileIOCopy = copy.deepcopy(xml_fileIO) xv.parse_resource(xml_fileIO) domTree = FromXmlStream(xml_fileIOCopy) "
Please send me any suggestion about my last email. Thanks in advance -----Original Message----- From: "Leticia Larrosa" <[EMAIL PROTECTED]> To: "Andrew Clover" <[EMAIL PROTECTED]>, xml-sig@python.org Cc: Date: Sun, 10 Apr 2005 15:48:20 -0400 Subject: [XML-SIG] validate file-like class object > Hi all! > > I received a StringIO, file-like class object, that contain an XML. I > need > parser it, but before i need validate it. > Then I make a slight change to the > "_xmlplus\parsers\xmlproc\xmlapp.py". I > replace the function "create_input_source" for: > " > def create_input_source(self,sysid): > if isinstance(sysid, StringIO.StringIO): > return sysid > elif sysid[1:3]==":\\" or urlparse.urlparse(sysid)[0] == '': > return open(sysid) > else: > return urllib2.urlopen(sysid) > " > > and add the following import line: > > "import StringIO.StringIO" > > As you can see, now "sysid" may be an StringIO instance. Read the > following > code to see how i use the above change. > > " > from xml.parsers.xmlproc import xmlval > from xml.dom.ext.reader.Sax2 import FromXmlStream > > xv = xmlval.XMLValidator() > #xml_fileIO is instance of StringIO.StringIO that contain an XML. > xv.parse_resource(xml_fileIO) > domTree = FromXmlStream(xml_fileIO) > " > Please send me any suggestion. > > What can i do to incorporate this change in the standard library? > > Thanks in advance > > > > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig > > _______________________________________________ XML-SIG maillist - XML-SIG@python.org http://mail.python.org/mailman/listinfo/xml-sig