XML Input

XSD Schema Output

XML Schema Generator Examples

Sample XML is analyzed to infer an XSD schema. Example:

XML input vs generated XSD

Input XML:

Input

Generated XSD schema:

Output

Use Sample above to load more example data. The actual output may vary based on the schema generator logic.

What Is an XML Schema Generator?

XSD (XML Schema Definition) is a W3C standard for describing the structure, data types, and constraints of XML documents. It defines which elements and attributes are allowed, their order, and their content types. The W3C XML Schema specification defines the full XSD syntax.

This tool infers an XSD schema from a sample XML document. It analyzes elements, attributes, and nesting to produce a starting schema. Generation runs in your browser; nothing is sent to a server. You can then refine the schema manually for validation, documentation, or code generation.

How to Use This Tool

1

Paste or Upload XML

Paste your XML into the left editor or upload a file. Use Sample for example data. The more representative the sample (including optional elements, attributes, and varied content), the better the inferred schema. Ensure the XML is well-formed.

2

Review the Generated XSD

The right panel shows the generated XSD. Elements, attributes, and types are inferred from the sample. Check that the structure matches your expectations. You may need to adjust minOccurs, maxOccurs, or add constraints.

3

Copy, Download, or Edit

Use <strong>Copy</strong> or <strong>Download</strong> to save the schema. Edit it as needed for your use case. For validating XML against an XSD, use XML Validator. For JSON Schema from JSON, use JSON Schema Generator.

When to Use a Generated Schema

Use a generated XSD when you have sample <a href="https://www.w3.org/TR/xml/" target="_blank" rel="noopener">XML</a> and need a schema for validation, documentation, or tooling (e.g. code generation, IDE support). Common for <a href="https://www.w3.org/TR/soap12/" target="_blank" rel="noopener">SOAP</a> APIs, RSS feeds, or enterprise integrations. It's a starting point—inferred schemas reflect only what appears in the sample. For JSON, use JSON Schema Generator.

Frequently Asked Questions

Is the schema complete?

It reflects the sample. Optional elements, minOccurs/maxOccurs, and constraints may need manual tuning. The generator infers structure from what it sees; it cannot know about elements that don't appear in your sample.

Can I validate XML against this XSD?

Yes. Use an XSD validator (e.g. XML Validator or external tools). This tool generates the schema; validation is a separate step. Ensure your XML references the schema correctly.

Is my data private?

Yes. Schema generation runs entirely in your browser. No XML or schema is sent to any server.

Related Tools

For XSD syntax and semantics, see W3C XML Schema and the XML Schema 1.1 Part 1. For XML, see the W3C XML specification and W3C XML. For parsing XML in the browser, see MDN DOMParser. For XPath (used in XSD), see XPath 3.1. For JSON Schema, see JSON Schema.