xml parsing escape characters
Fredrik Lundh
fredrik at pythonware.com
Fri Jan 21 13:08:06 EST 2005
Luis P. Mendes wrote:
> xml producer writes the code in Windows platform and 'thinks' that every
> client will read/parse the code with a specific Windows parser. Could
> that (wrong) XML code parse correctly in that kind of specific Windows
> client?
not if it's an XML parser.
> Do you know any windows parser that could turn that erroneous encoding
> to a xml tree, with four or five inner levels of tags?
any parser *can* do that, but I doubt many parsers will do it unless
you ask it to (by extracting the string and parsing it again). here's the
elementtree version:
from elementtree.ElementTree import parse, XML
wrapper = parse(urllib.urlopen(url))
dataset = XML(wrapper.findtext("{http://www......}string"))
</F>
More information about the Python-list
mailing list