Reputation: 9432
I was wondering how it is possible to escape special characters in an xml.
The following example fails sadly:
xml ="""<?xml version="1.0" encoding="UTF-8" ?>
<Render value="a < b"/>
"""
import xml.etree.ElementTree as ET
p = ET.fromstring(xml)
Output:
ParseError: not well-formed (invalid token): line 2, column 28
What is the easiest way round this problem?
Upvotes: 2
Views: 367
Reputation: 9432
Wrong escaping!
Try
<Render value="a < b"/>
And everything works fine!
Upvotes: 1