XML from XSD

Generate a sample document from an XML Schema, including schemas spread over many files. Values fit their enumerations, patterns, lengths and ranges, and the sample is validated against the schema right away. Everything runs in your browser.

Root element

XML Schema

· choose the entry point

Sample XML

The schema is large: optional content was left out past some 5,000 elements, and recursion cut where it went deep.

Validating the sample against the schema…

How to generate XML from an XSD

  1. Paste the schema, or open its files: all of them when it imports or includes others, or the whole folder. The entry point is marked main.
  2. Choose the root element, if the schema declares several, and whether optional elements and attributes go in.
  3. Press Generate. The sample is validated against the schema and the result shown under it.

What the sample contains

  • Every required element and attribute, and with Optional content on, each optional one once.
  • The first possible branch of each xs:choice, a substitute for an abstract element, and an xsi:type where a type is abstract.
  • Values that keep to the facets: the first enumerated value, a string built from the xs:pattern, lengths and numeric ranges respected. Text values are named after their element, so you can see what goes where.
  • Recursive structures are written once, where the schema allows stopping.

Identity constraints (xs:key, xs:keyref, xs:unique) are not taken into account; the validation under the sample shows when one is broken.

Official schemas

The tool is checked against every XSD in our schema catalog: UBL, CII, Factur-X, FatturaPA, ISO 20022, HL7 CDA and more, and those entries come with real examples already. For your own schema, see the XSD validator to check documents against it.

Questions

Is my schema uploaded?

No. The schema is read, the sample generated and validated in your browser.

Does it handle imports and includes?

Yes. Open all the schema files, or the folder they are in; paths in schemaLocation are resolved as on disk, or by file name when the layout was lost. Files on the web are not fetched.

Is the sample always valid?

It is built to be, and validated to make sure. Identity constraints and patterns that are hard to satisfy can make it fail; the errors are listed with their lines.

Can it make XML from a DTD?

No, from XML Schema (XSD) only.

Other tools

  • XML formatter: Pretty-print or minify XML, keeping text, CDATA and comments as written.
  • XPath tester: Evaluate XPath 3.1 against a document and see each match with its line.
  • XSD generator: Infer an XML Schema from sample documents, checked against them.
  • XSLT transformer: Run XSLT 1.0, 2.0 or 3.0 on a document and see the result, the messages and the files it writes.
  • XML diff: Compare two XML documents as trees: changed, added and removed elements, attributes and text.
  • XML to JSON converter: Convert XML to JSON, with arrays where an element repeats or wherever its XSD allows.
  • JSON to XML converter: Convert JSON to XML: @keys become attributes, arrays repeated elements.
  • XML to CSV converter: Turn a repeating element into CSV rows: invoice lines, products, records.
  • E-invoice viewer: Read an XRechnung, ZUGFeRD, Factur-X or Peppol invoice as a document, and print it.
  • XML validator: check a document against XSD, DTD, RelaxNG or Schematron, up to 1 GB.