xml parsing escape characters

"Martin v. Löwis" martin at v.loewis.de
Thu Jan 20 19:37:31 CET 2005


Irmen de Jong wrote:
>> 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?

You said it in response to

 >>> All the behaviour you are seeing is a consequence of this. You need
 >>> to unescape the contents of the <string> tag to be able to treat it 
 >>> as structured XML.

In that context, I interpreted

 >> The unescaping is usually done for you by the xml parser that you
 >> use.

as "The parser should have done what you want; if the parser didn't,
that is is bug in the parser".

> 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.

Either of these, indeed - probably the latter.

Regards,
Martin



More information about the Python-list mailing list