How to escape special characters in xml attribute using python -


i wondering how possible escape special characters in xml.

the following example fails sadly:

xml ="""<?xml version="1.0" encoding="utf-8" ?>     <render value="a &lt b"/> """ import xml.etree.elementtree et p = et.fromstring(xml) 

output:
parseerror: not well-formed (invalid token): line 2, column 28

what easiest way round problem?

wrong escaping!

try

<render value="a &lt; b"/>

and works fine!


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -