Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python
import untangle
xml = '''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TestXml [
<!ELEMENT TestXml (TestNode*)>
<!ELEMENT TestNode (#PCDATA)>
<!ENTITY testent "test entity">
]>
<TestXml>
<TestNode>&testent;</TestNode>
</TestXml>
'''
data = untangle.parse(xml)
# prints "test entity"
# but I want just "&testent;"
print(data.children[0].children[0].cdata)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment