stchris / untangle

Converts XML to Python objects
MIT License
612 stars 83 forks source link

class is a reserved word, consider using _class to replace class #53

Closed geektutu closed 2 years ago

geektutu commented 6 years ago
<?xml version="1.0"?>
<root>
    <class>Moc</class>>
</root>
doc = untangle.parse("test.xml")
print(doc.root.class)

#     print(doc.root.class)
#                      ^
# SyntaxError: invalid syntax

class is a reserved word, consider using _class to replace class

mhadam commented 3 years ago

Agreed, ran into this issue where an element is named None.

Edit: Realized you can use getattr(o, "None") in the meantime, though will try to make a PR for this issue when I get the chance.

stchris commented 2 years ago

Similar issue: #42 . Was fixed with #43