Test files › Structured data › valid.xml

Sample XML file (valid)

Well-formed XML with namespaces, attributes, CDATA and a comment.

↓ Download valid.xml
Filenamevalid.xml
FormatXML
Size395 bytes (395 bytes)
MIME typeapplication/xml
SHA-25683894bdebdcc14d2a95a4144e89839b39b66b775dc53fde2a886a3f78549f490
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

Sample XML fileUpload validation checklistVerify its SHA-256

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

More structured data test files

precision-loss.jsonvalid-small.jsonbillion-laughs.xmlunclosed-tag.xmlxxe-file-disclosure.xmlnorway-problem.yamltabs-invalid.yaml1000-rows.csv

← All Structured data files