[Tkinter-discuss] Problem with the special characters while parsing XML SAX

Gurpreet Sachdeva redhackgp at rediffmail.com
Wed Sep 8 15:07:47 CEST 2004


An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20040908/580161ca/attachment.html
-------------- next part --------------
  
  
I am parsing an XML file using xml.sax and xml.sax.handler
But the program does not run succesfully as there are some special characters in the XML file. Where can be the problem? How can I find the special characters and escape them. Can I convert them into Unicode? Can anybody point to a good document? Thanks alot...

[CODE SNIPPET]
if __name__ =='__main__':
	try:
		doccorpus = raw_input('enter file: ')
		parser = xml.sax.make_parser()
		handler = docHandler()
		parser.setContentHandler(handler)
		parser.parse(doccorpus)
		print 'file parsed successfully'
	except:
		print position
		print 'file parsing unsuccessful'
[/CODE SNIPPET]


More information about the Tkinter-discuss mailing list