XSD Generator
Generates an XSD (XML Schema) from an XML document. The generator uses a smart approach to infer data types.
Loading tool...
XML Schema (XSD) explained
What is an XSD?
An XML Schema Definition (XSD) describes the structure that an XML document must follow: which elements and attributes may appear, in which order, how many times, and which data type their content must have.
How this generator works
- Every element of your document is visited. Elements with the same name and parent path are merged.
- A child element becomes
minOccurs="0"when at least one parent does not contain it. - An attribute is
use="required"when every occurrence of the element carries it. - Elements containing only text get a simple type; elements with attributes and text use
xs:simpleContent.
Data type inference
| Values look like | Inferred type |
|---|---|
true, false |
xs:boolean |
42, -7 |
xs:integer |
3.14, -0.5 |
xs:decimal |
6.02e23 |
xs:double |
2024-03-15 |
xs:date |
2024-03-15T10:30:00 |
xs:dateTime |
| anything else | xs:string |
Schema design patterns
- Russian Doll: compact, self-contained; no reuse.
- Salami Slice: maximum reuse; flat declarations with
ref. - Venetian Blind: named types, reusable and extensible. Recommended for most schemas.