xml parsing escape characters

Irmen de Jong irmen at -nospam-remove-this-xs4all.nl
Thu Jan 20 13:13:36 EST 2005


Martin v. Löwis wrote:
> Irmen de Jong wrote:
> 
>> The unescaping is usually done for you by the xml parser that you use.
> 
> 
> Usually, but not in this case. If you have a text that looks like
> XML, and you want to put it into an XML element, the XML file uses
> < and >. The XML parser unescapes that as < and >. However, it
> does not then consider the < and > as markup, and it shouldn't.

That's also what I said?

The unescaping of the XML entities in the contents of the OP's
<string> element is done for you by the parser,
so you will get a text node with the <,>,&,whatever in there.
The OP probably wants to feed that to a new xml parser instance
to process it as markup.
Or perhaps the way the original XML document is constructed is
flawed.

--Irmen



More information about the Python-list mailing list