SAX: `raw XML'

Jim Hefferon jhefferon at smcvt.edu
Tue May 6 12:41:52 EDT 2003


Hello,

I'm struggling with learning XML processing, and in particular with the 
interaction with Python's unicode strings.

I'm writing a routine to parse XML using SAX.  I'm worried about the kind
of strings that the SAX parser is giving me.  In my startElement
the documentation describes the parameter `name' as a "raw XML 1.0 string".  
Does that mean that to process it (in the Right Way) I should use a Python
unicode string?  Should I say something like

def startElement(self,name,attrs):
    if ((self._state==u"start")
        and (name==u"FirstName")):
        self._state="FirstName"
    elif ..
 
?  And the attributes go the same way?

Thanks,
Jim Hefferon




More information about the Python-list mailing list