What is a XML file?
XML is a markup format for structured data: elements in angle brackets, attributes, text and a single root element. A file is well-formed when every tag closes, attributes are quoted and only defined entities are used.
Parsers differ in how they treat CDATA, internal entities, namespaces and processing instructions, and in how they report errors. A broken file shows whether your code fails clearly or silently reads half the data.
Anatomy of a XML file
<?xml …?>The declaration with version and encoding<records>Exactly one root elementid="1"Attributes, always quoted<![CDATA[ … ]]>Text taken literally, markup and all&company;An entity, defined in the DOCTYPExmlns:x="…"A namespace prefix
What you can generate
- Attributes with escaped quotes and ampersands
- CDATA sections and comments
- Internal entities in a DOCTYPE, plus character references
- Namespaces with a default and a prefixed namespace
- Processing instructions and empty elements
- Unicode text
- Broken on purpose: unclosed tag, undefined entity, two root elements
How to make one
- Open the XML generator, or start from a preset above.
- Set the size and switch on the edge cases you need; the preview and size estimate follow every change.
- Generate, then download. The file is made in your browser, and the same preset and seed always give you the same file.
Questions
Yes, unless you choose a damage option. The tests parse every well-formed file with a strict parser (Python's expat).
No. The only entity is an internal one, so the files are safe to open; they are not XXE payloads.
There is no XSD with the file. It tests parsing, not schema validation.