Created
November 5, 2015 15:02
-
-
Save msikma/3d5334e022967c65e2b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import xml.etree.ElementTree as ET | |
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> | |
''' | |
tree = ET.fromstring(xml) | |
# prints: test entity | |
# but I want: &testent; | |
print(tree[0].text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment