XML Schema Generator (XML to XSD)

Generate XSD schema from an XML file.

Was this helpful?
Share Tool

Paste a representative XML document. The tool infers elements and a rough schema. Inference from one sample will miss optional fields and unions.

Processing is local. Do not paste customer XML that contains secrets.

How to generate an XSD

  1. Paste well-formed sample XML.
  2. Generate and read the types — most numbers arrive as strings unless you edit them.
  3. Add optional elements the sample omitted.
  4. Validate future payloads against the edited XSD in your toolchain.

Key Features

  • Sample-driven starter XSD
  • Local only
  • No XML uploaded to FlashKit
  • Pairs with HTML/JSON validators

The sample document, and a second order document

  • The sample already in the box is a root element containing one person. person has attribute id 1 and children name, age 30, and active true. Generate produces a schema whose root and person are complex types. person contains a sequence of name as xs:string, age as xs:integer, active as xs:boolean, then an attribute id of type xs:integer with use optional. The name text itself does not appear in the schema.
  • A different document, order id A-9, with when 2026-12-05, price 19.99, qty 2, an empty note, sku 001, flag TRUE, and two item children pen and pad, types when as xs:date, price as xs:decimal, qty as xs:integer, note as xs:string, sku as xs:integer, flag as xs:boolean, and a single item as xs:string. id A-9 is xs:string because of the hyphen. Both item elements become one declaration.
  • sku 001 matches a run of digits, so it is typed xs:integer. A later code of 001 is not protected as text. 2026-02-31 also matches the date pattern and is typed xs:date even though it is not a real day. yes is a string. TRUE is a boolean.

Limits that make the XSD reject the sample you started from

  • The second item is not given maxOccurs unbounded. A schema from that order document describes one item. Validating the original XML, which has two item elements, fails the schema the tool just wrote. Attributes are always use optional, even when every sample has them.
  • Child order in the sequence follows the first time each tag is seen. A later document that swaps two elements fails that sequence. Mixed content and namespaces are not modelled. An unclosed tag stops with Invalid XML Input and writes no schema.
  • One sample cannot show an optional branch that was absent. A missing middle element becomes required, because it was present this time. Edit the XSD before you treat it as a contract.

How to turn one sample into a schema you can edit

  • Paste a document that contains every element you care about, including a repeated row if the real feed repeats. Generate, then add maxOccurs where a tag appeared more than once, and change 001-style codes from xs:integer to xs:string.
  • Validate a second, different payload in your own toolchain. This page does not run that validation.

Frequently Asked Questions

Is the XSD complete?

Rarely. One document cannot show every optional branch.

Categories

Browse all FlashKit tools