On 10/17/2010 09:20 PM, Peter Conerly wrote:
Hello SeaPIG!

My name is Pete and I'm taking the UW Python certification course.  As
one of my small projects I'm using the SAX interface for python.

The XML file I'm processing is not well-formed.  Some of the tags don't
have end tags.  How can I deal with this, within the program?  (I want
this program to deal with any of identically-structured XML files, so
manually fixing tags is out of the question.)

I feel like my two options are:
1. Pre-process the XML files and adds end tags (like </tag>) to the
elements.
2. Use the parser or parser error handler to ignore the problem.  (I
don't need any data from the mis-formed elements.)

Any ideas?

Try this instead: http://www.crummy.com/software/BeautifulSoup/

"Beautiful Soup won't choke if you give it bad markup."

Dan

Reply via email to