Test files › Structured data › valid.xml
Sample XML file (valid)
Well-formed XML with namespaces, attributes, CDATA and a comment.
↓ Download valid.xml| Filename | valid.xml |
| Format | XML |
| Size | 395 bytes (395 bytes) |
| MIME type | application/xml |
| SHA-256 | 83894bdebdcc14d2a95a4144e89839b39b66b775dc53fde2a886a3f78549f490 |
What this file catchesBaseline for the XML parser cases below.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Python's standard parser (expat 2.4.1 or later) refuses entity-expansion bombs and does not fetch external entities, so this file fails to parse instead of attacking you. Parsers in other languages differ: make sure DTDs and external entities are disabled in yours. For untrusted XML in Python, the defusedxml package forbids entity declarations outright.
import xml.etree.ElementTree as ET
try:
ET.parse("valid.xml")
print("parsed")
except ET.ParseError as e:
print("refused:", e)Run against this file, it prints: parsed
Related guides and tools
Download & verify
curl -fsSL -o "valid.xml" "https://files.hexaqa.com/xml/valid.xml"
curl -fsSL "https://files.hexaqa.com/xml/valid.xml" | sha256sum
# expect: 83894bdebdcc14d2a95a4144e89839b39b66b775dc53fde2a886a3f78549f490