About this tool
An XSD (XML Schema Definition) describes the shape a family of XML documents is allowed to take: which elements can appear, in what order, how many times, which attributes each one carries, and what type of data belongs in each — a string, an integer, a date. XML and XSD are two views of the same structure, one a concrete example, the other the rule set behind it, and going from either one to the other is a common, tedious-by-hand task. This tool covers both directions.
XML → XSD walks the whole document you paste in once. For every element name it sees, it records the attributes that appear on it, the child elements inside it and the order they show up in, and — for elements that hold plain text rather than nested elements — the text itself, which it uses to guess a data type. If every <tools> element in your sample contains a plain integer, the generated schema types it as xs:integer rather than the always-safe fallback of xs:string. The same reasoning applies to decimals, booleans, dates, and full timestamps. Occurrence rules come from comparing multiple instances of the same parent element, when your sample has more than one: a child missing from at least one instance is marked optional (minOccurs="0"), and one that appears more than once inside any instance is marked repeatable (maxOccurs="unbounded"). An attribute is marked required only if it was present on every occurrence of that element in your sample. Because all of this is inferred from a single example, treat the result as a solid first draft to review, not a guaranteed-final contract.
XSD → XML works the other way: it reads the element and type definitions in your schema and builds one representative XML document that satisfies them. Required and optional elements are both included, since the goal is a complete example rather than the smallest possible valid document. An element that can repeat (maxOccurs="unbounded") is shown twice, to make the repetition visible; a bounded repeat count generates that many, capped at three for readability. Element and attribute values are filled with a placeholder appropriate to the declared type — an integer becomes 0, a boolean becomes true, a date becomes a sample date — or, where a simpleType restricts values to an enumeration, the first listed enumeration value. Self-referencing schemas (an element type that contains itself, directly or through a chain of types) are expanded a bounded number of times so the output stays finite and readable.
Everything runs locally in your browser using the built-in XML parser; nothing you paste is transmitted anywhere.
| XML value | Inferred XSD type | XSD type | Generated sample value |
|---|---|---|---|
| 15 | xs:integer | xs:integer | 0 |
| 49.99 | xs:decimal | xs:decimal | 0.0 |
| true / false | xs:boolean | xs:boolean | true |
| 2026-01-15 | xs:date | xs:date | 2026-01-01 |
| 2026-01-15T09:30:00Z | xs:dateTime | xs:dateTime | 2026-01-01T00:00:00Z |
| anything else | xs:string | xs:string | string |