0 elements0 complex typesno namespace

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?

XML to XSD conversion reads a sample XML document and writes an XML Schema that describes that sample: elements, attributes, repeated children, optional children, and simple types for leaf text. Use this free generator to paste or drop XML and download schema.xsd. The schema matches the sample you provide, and generation stays in your browser.

What you can do here

Draft an XML schema from a sample document.
  1. XML to XSD: Generate a schema from the structure of one well-formed XML document.

  2. Elements and repeats: Child order follows the sample. Repeated siblings become unbounded.

  3. Simple types: Leaf text is string, integer, decimal, boolean, or date when the values agree.

  4. Copy and download: Copy the XSD or save schema.xsd.

How to generate an XSD from XML

Three steps from a sample document to a schema.
  1. Paste or drop XML

    Use a well-formed document. The sample on the page is a short catalog.

  2. Read the schema

    Check element names, minOccurs, and the inferred types for leaf text.

  3. Download schema.xsd

    Save the file or copy it into a project. Extend it when the sample was incomplete.

Tips for a useful schema

The sample is the 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

XML to XSD jobs.
  • 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

A local XML to XSD generator.
  • 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

How this XML to XSD generator builds the schema.
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

Specifications for the schema this page writes.
  • “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 (XSD) 1.1 Part 1: Structures

    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

    W3C — Extensible Markup Language (XML) 1.0: The sample document is parsed as XML before any schema is generated. w3.org/TR/xml/

Frequently Asked Questions

Quick answers about this tool—open a question to read more.