XML Problem/Confusion?

Benjamin Schollnick junkster at rochester.rr.com
Tue Jun 12 01:33:44 CEST 2001


I'm attempting to finish a pseudo webdav interface class...

The only problem is that the XML results I'm receiving aren't being 
handled correctly....

This test application seems to be ignoring several of the entries from 
the captured stream.

The XML looks AOK to me, but I haven't written XML before, and I'm not 
sure if I'm reading this correctly.

Could anyone chime up, and point out any errors that I may have caused?

         - Benjamin

------------------------ Cut here
test_data = """<?xml version="1.0" ?>
<multistatus>
  <response>
    
<href>http://xww.psg-techservices.world.xerox.com/docushare/Collection-22
</href>
    <propstat>
     <prop>
  <displayname>TSA - Material in Transit</displayname>
  <displayname>TSA - Material in Transit</displayname>
  <summary>(Temporary Files)</summary>
<entityowner><dsref handle="User-2"><displayname>Benjamin 
Schollnick</displayname>
<username>admin</username></dsref></entityowner>
<parents>
<dsref handle="Collection-10"><displayname><![CDATA[TSE - Test Support & 
Automation Folder]]></displayname></dsref>
</parents>
     </prop>
     <status>HTTP/1.1 200 OK</status>"""

#from xml.dom.minidom import parse, parseString
#dom = parseString (test_data)
#print dom.getElementsByTagName ("parents")
#print dom.getElementsByTagName ("handle")

import xml.parsers.expat

def     start_element(name, attrs):
        print "Start :",name, "\t\tattrs: ",attrs

def     end_element(name):
        print "End :",name
        pass
        
def     char_data (data):
        print "Character : ", repr(data)
        pass
        
parser = xml.parsers.expat.ParserCreate()
parser.EndElementHandler        = end_element
parser.StartElementHandler      = start_element
print "XML.Parsers.Expat \n------------------------------------------"
parser.Parse (test_data)
#print "xml.sax \n------------------------------------------"

#import xml.sax
#dparser2 = xml.sax.make_parser()
#print xml.sax.parseString(test_data, dparser2)



More information about the Python-list mailing list