What makes an XML document well-formed?
An XML document is well-formed when it has exactly one root element, every tag is closed and properly nested, attribute values are quoted, and the five special characters are escaped. Being valid is a stronger property: the document also conforms to a schema or DTD. Formatters and validators check the first; contract tools check the second.
Security note: XML parsers that resolve external entities can be made to read local files or call internal URLs (XXE). Disable DTD processing and external entities in any parser that receives untrusted XML.
How to use XML Dataset Generator
- Describe the record fields.
- Set root/record names, attribute mode and namespace.
- Press Generate and download the XML.
XML Dataset Generator features
- Field schema shared with the CSV and SQL generators
- Configurable root and record element names
- Fields as elements, attributes or mixed (ids as attributes)
- Namespace URI with optional prefix on every element
- XML declaration and pretty-printing toggles; always well-formed and escaped
- Up to 5,000 records, seedable, with preview
XML Dataset Generator example
Product catalogue
Input:
id:id
name:product
price:price:5-900 · Root: catalog · Record: item · Mode: Mixed · Namespace: urn:example:cat (prefix c)Output:
<?xml version="1.0" encoding="UTF-8"?>
<c:catalog xmlns:c="urn:example:cat" count="2">
<c:item id="1">
<c:name>Wireless Keyboard</c:name>
<c:price>129.5</c:price>
</c:item>
…
</c:catalog>Frequently asked questions about XML Dataset Generator
Can fields be attributes instead of elements?
Yes — choose attributes, elements, or mixed (id-like fields as attributes, the rest as elements).
How do namespaces work?
Give a namespace URI and optionally a prefix; the root declares xmlns (or xmlns:prefix) and every element is prefixed. Special characters are escaped so the document is always well-formed.
Is the output valid XML?
Yes, it is produced by an XML builder with proper escaping and can be validated with the XML Validator tool.
References
- Extensible Markup Language (XML) 1.0 (Fifth Edition)What makes an XML document well-formed: elements, attributes, entities, character encoding and the prolog.
- OWASP Cheat Sheet Series: XML External Entity PreventionWhy XML parsers must disable external entities and DTDs, and how to configure common parsers safely.
- RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) FilesThe commonly implemented CSV rules: comma separators, CRLF line ends, quoting of fields that contain commas, quotes or line breaks.
- Personal Data Protection Law (English translation)The Saudi law governing personal data — why test environments should use synthetic data rather than copies of real customer records.