xml.sax problem

2008-03-23 Thread Timothy Wu
Hi, I have created a very, very simple parser for an XML. class FindGoXML2(ContentHandler): def characters(self, content): print content I have made it simple because I want to debug. This prints out any content enclosed by tags (right?). The XML is publicly available here: http://e

Re: xml.sax problem, help needed.

2006-08-03 Thread K.S.Sreeram
Hari Sekhon wrote: > I've written an xml parser using xml.sax which works most of the time > but often traces back when trying to read a file. The output of the > traceback is below: > > Traceback (most recent call last): > File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", > line

xml.sax problem, help needed.

2006-08-01 Thread Hari Sekhon
I've written an xml parser using xml.sax which works most of the time but often traces back when trying to read a file. The output of the traceback is below: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line 271, in run main() File "/

Re: xml.sax problem: getting parse() to read a string

2006-06-05 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > as mentioned in the documentation, and implied by my answer, parseString > is a helper function in the xml.sax module, not a parser method. try doing > > xml.sax.parseString(string, handler) > > instead of that make_parser/setContentHandler/parse dance. > > Thanks a

Re: xml.sax problem: getting parse() to read a string

2006-06-05 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I am getting the following error. > > File "acmtest.py", line 205, in parseMessage > parser.parseString(message) > AttributeError: ExpatParser instance has no attribute 'parseString' > > Am I simply missing that library here? Or am I calling it incorrectly? as me

Re: xml.sax problem: getting parse() to read a string

2006-06-05 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > if you want to parse a string, use xml.sax.parseString instead of > xml.sax.parse. > > My function has changed to the following (parseString call instead of parse): def parseMessage(self, message): #create a XML parser parser = make_parser() #c

Re: xml.sax problem: getting parse() to read a string

2006-06-05 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > So in recap, it looks like it is trying to take my string argument as a > file handler. How can I get around this? if you want to parse a string, use xml.sax.parseString instead of xml.sax.parse. -- http://mail.python.org/mailman/listinfo/python-list

xml.sax problem: getting parse() to read a string

2006-06-05 Thread [EMAIL PROTECTED]
Hey all, I recently came across the xml.sax libraries and am trying to use them. I am currently making a string variable, and am attempting to pass it into a parser instance as follows: def parseMessage(self, message): #create a XML parser parser = make_parser() #cre