Parsing xml file using python
peter at engcorp.com
Fri Mar 5 16:13:18 CET 2004
> I am new to Python.
> I need to read an XML document and ignore all XML tags and write only
> those between the tags to a text file. In other words, if I have an
> XML document like so:
> I need to write "This is a test" to a text file. How do I achieve
> this? Thanks.
Note that what you have above is _not_ an XML file. That is, it looks
like XML but it's not well-formed, as it doesn't have a single enclosing
You probably meant that just as a quickie example, but in case that's
like what your actual data format looks like, you'll have trouble using
any of the Python XML parsers. (The fix is pretty trivial though.)
More information about the Python-list