Sample XML files
XML files for parser testing: 100 orders with child elements and attributes, a product catalogue that uses two namespace prefixes, and a deliberately broken file with an unclosed element. Free, no sign-up. Updated 19 November 2026.
What these files are
XML files for parser testing: 100 orders with child elements and attributes, a product catalogue that uses two namespace prefixes, and a deliberately broken file with an unclosed element.
Every file was generated by our own code, so nothing in them is copied from anyone, and we release them under CC0: use them for anything. The facts in the table were read back from each file after it was written, not typed in by hand.
About the format
XML 1.0 is a W3C recommendation. A well-formed document has exactly one root element, every start tag has a matching end tag, and attribute values are quoted; a conforming parser must stop at the first error, which is what the invalid sample is for. Namespaces bind a prefix such as p: to a URI so that element names from different vocabularies do not clash.
These files open in web browsers, text editors and xmllint. A web server should send them with the header Content-Type: application/xml.
3 files to download
| File | Size | What it is |
|---|---|---|
| sample-orders.xml | 28 KB | 100 <order> elements with 7 child fields each, UTF-8 with an XML declaration elements: 100; well formed: yes |
| sample-namespaces.xml | 3 KB | 20 products using two XML namespace prefixes elements: 20; well formed: yes |
| sample-invalid.xml | 150 B | deliberately broken: one <order> is never closed, for testing parser errors well formed: no |
MIME type: application/xml. Total 31 KB.
Good for testing
- XML parsers, XPath and XSLT
- Namespace handling
- Error messages for malformed input
Check a file
xmllint --noout sample-orders.xml && echo valid
xmllint --noout sample-invalid.xml # reports the errorCompare the SHA-256 checksum to make sure the download is complete and unchanged (sha256sum file on Linux, shasum -a 256 file on macOS, certutil -hashfile file SHA256 on Windows):
| File | SHA-256 |
|---|---|
| sample-orders.xml | da74a5801257226ca9fc38f40548f87f69629569b9b504d92cf53492f1f73580 |
| sample-namespaces.xml | 10726322ec98459560846e38e1b42b62e4dc4bdc142d49065814e62e74025271 |
| sample-invalid.xml | 8db824e1e0e2767a0518250e8f60616e33adc0629f9ebfa33563fc07def68a76 |