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 < 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 < b"/>
and works fine!
Comments
Post a Comment