You can switch to BeautifulSoup parser - it's more forgiving in terms of well-formness. Example:
from bs4 import BeautifulSoup
data = """
<Rectangle
leftTopX = 0
leftTopY = 0
rightBottomX = 20
rightBottomY = 40 />
"""
soup = BeautifulSoup(data)
print soup.rectangle
prints:
<rectangle lefttopx="0" lefttopy="0" rightbottomx="20" rightbottomy="40"></rectangle>
You may also use it with lxml
parser (you'll need lxml
installed):
soup = BeautifulSoup(data, "lxml")
Hope that helps.