This browser cannot parse XML.
Drop XML
or paste below — max 1.5 MB
The schema describes this sample: repeated elements become unbounded, and a child that is missing from one parent is optional. Parsing stays in your browser.
Help Us Improve
—
(—)
XML to XSD schema generator
Generate an XSD schema from a sample XML file: elements, repeats, and simple types. Free, no sign-in.
What is XML to XSD conversion?
What you can do here
XML to XSD: Generate a schema from the structure of one well-formed XML document.
Elements and repeats: Child order follows the sample. Repeated siblings become unbounded.
Simple types: Leaf text is string, integer, decimal, boolean, or date when the values agree.
Copy and download: Copy the XSD or save schema.xsd.
How to generate an XSD from XML
Paste or drop XML
Use a well-formed document. The sample on the page is a short catalog.
Read the schema
Check element names, minOccurs, and the inferred types for leaf text.
Download schema.xsd
Save the file or copy it into a project. Extend it when the sample was incomplete.
Tips for a useful schema
- 01
Include optional fields in at least one record
A child that is missing from one sibling and present on another is marked optional.
- 02
Include a repeated element
Two siblings with the same name are enough to mark that element unbounded.
- 03
Keep leaf values consistent
A column of whole numbers becomes xs:integer. One decimal in the set makes the type xs:decimal.
- 04
Start from a representative file
Elements that never appear in the sample are absent from the schema.
Great for
A first schema
Turn an example payload into XSD you can edit by hand.
Contract drafts
See which fields a sample treats as repeated, optional, or typed.
Documentation
Attach a generated schema next to a fixture so the shape is explicit.
Why generate here
Local-first
The document is parsed in the browser.
Free to use
No account to copy or download the schema.
No signup
Paste XML and read the XSD immediately.
Types from the sample
Repeats, optional children, and simple leaf types come from the document you provide.
Technical notes
- Input
- Well-formed XML up to 1.5 MB and 20,000 elements, nested up to 32 levels.
- Output
- XSD with xs:schema, a global root element, xs:sequence, and xs:complexType. Leaf text uses xs:string, xs:integer, xs:decimal, xs:boolean, or xs:date.
- Occurrence
- maxOccurs="unbounded" when a child repeats under one parent. minOccurs="0" when at least one parent omits that child.
- Privacy
- DOMParser runs locally. The XML is not uploaded.
Sources & References
“This document specifies the XML Schema Definition Language, which offers facilities for describing the structure and constraining the contents of XML documents, including those which exploit the XML Namespace facility.”
W3C — XML Schema Definition Language 1.1: Defines the schema components this generator writes: elements, complex types, sequences, and attributes. The output uses those 1.0-compatible constructs. w3.org/TR/xmlschema11-1/
“The Extensible Markup Language (XML) is a subset of SGML that is completely described in this document.”
W3C — Extensible Markup Language (XML) 1.0: The sample document is parsed as XML before any schema is generated. w3.org/TR/xml/