XSD Generator and XML Schema Validator

Drop in one or more sample XML files to get an editable schema model with types, occurrences and attributes, refine it and save the XSD in nested or named-type style. Then validate any XML against your own or a supplied XSD with line and column errors, batch-check folders of files and export the schema as HTML or Markdown documentation.

Działa w Twojej przeglądarce. Twoje pliki nigdy nie opuszczają urządzenia. Zobacz, jak to sprawdzić

…

Jak to zrobić

  1. 1
    Add samples

    Paste XML or add sample files; several real documents give better occurrence and type guesses.

  2. 2
    Infer the schema

    Pick nested or named-type style, the integer type and whether to detect enumerations, then press Infer schema from samples.

  3. 3
    Edit the model

    Tap elements to change names, types, occurrences, child order, attributes and restrictions, and add documentation text.

  4. 4
    Save the XSD

    Copy or download the generated .xsd, or send it to the validator with one tap.

  5. 5
    Validate XML

    Paste or open an XML file, or batch validate several, and read the errors with line, column and path.

  6. 6
    Export documentation

    Print the schema reference as a PDF or download it as HTML or Markdown for your team.

O tym narzędziu

XML still carries invoices, bank statements, government returns, product feeds, configuration and data exchange between older systems, and almost every one of those formats is defined by an XSD. When you receive XML without a schema you need one to document and check it; when you have a schema you need to know exactly which element breaks it. This tool does both in the browser. The generator reads your sample files with a position-aware parser, gathers every element and attribute per path, counts how often children appear in each parent, merges the child order across samples and guesses types from the values: boolean, integer, decimal, date, dateTime, time, anyURI or string, with optional enumerations when a field only ever takes a few values. The result is a tree you can edit: rename elements, change a type, set minOccurs and maxOccurs, switch a group between sequence, choice and all, mark content as mixed, add attributes and restrictions such as allowed values, a pattern, lengths and numeric ranges, and write documentation text. The XSD is written either in nested Russian-doll style or with named complex types, with a target namespace if your samples use one. The validator reads any XSD 1.0 schema you paste or open and checks an XML document against it, reporting every problem with its line, column and element path, for example a missing required attribute, an unexpected element with the list of elements allowed at that point, a value outside an enumeration, an invalid date or a decimal with too many places. Batch mode validates many files at once and lists the error count per file.

What the validator understands

Global and local elements and element references, minOccurs and maxOccurs, sequence, choice and all with nesting, xs:any with namespace and processContents, model groups and attribute groups, complex types with mixed content, simple content and complex content extension or restriction, attributes with use, fixed and default values and anyAttribute, simple types by restriction with every XSD 1.0 facet, list and union types, all built-in types with their lexical rules and ranges, nillable with xsi:nil, ID uniqueness and IDREF targets, and the target namespace with elementFormDefault and form.

What is not supported

xs:import, xs:include and xs:redefine of other files are not fetched (paste the needed declarations into one schema), identity constraints (key, keyref, unique), substitution groups, xsi:type, abstract, block and final checks, XSD 1.1 assertions, DTD validation and external entities. The pattern facet runs on JavaScript regular expressions with \i and \c approximated; character class subtraction is reported as unsupported.

Tested against

The parser, inference and validator were checked with our own sample orders, namespaced schemas, extensions, choices, patterns, dates and numeric facets, written from the W3C XSD 1.0 recommendation. They were not compared file by file with xmllint, Xerces or Saxon, which may word errors differently and catch constraints this page leaves out.

Inference limits

A schema can only describe what the samples show. Add several real files so optional elements and repeated elements are detected, then review types: a code like 007 looks like an integer but should usually stay a string.

Privacy

Files are read in this tab and never uploaded, which matters for invoices, payroll and health records exchanged as XML.

Przykład z rozwiązaniem

An integration team receives 3 sample order exports of 40 to 120 KB with no schema. The generator finds 18 element paths and 9 attributes: order repeats, note appears in only one order so it becomes minOccurs 0, status takes the values paid, new and shipped and becomes an enumeration, and price values such as 44.95 become xs:decimal. The team changes sku from xs:integer to xs:string with a pattern for two capital letters, a hyphen and four digits, saves the XSD in named-type style and validates a fourth file. The validator reports 3 problems: line 212 qty is two instead of an integer, line 540 date 2026-02-30 does not exist, and line 803 a note element appears before total, where the schema expects item or total.

W skrócie

Najczęstsze pytania

Can I generate an XSD from a single XML file?

Yes, but one sample cannot show which elements are optional or which repeat in other documents. Add a few real files; elements missing from some samples become minOccurs 0 and repeated ones get maxOccurs unbounded.

Does it validate against schemas that import other XSD files?

Imports and includes are not fetched. Paste the declarations from the imported schema into the same XSD, or validate against the main schema and treat the missing types as a warning the tool shows.

How are errors reported?

Each problem has the line and column in your XML, a plain description such as Required attribute id is missing or Unexpected element note, expected item or total, and the element path like /orders/order[2]. The first error line is highlighted in the editor.

Can I validate many files at once?

Yes. Load the XSD, then use Batch validate files to pick a set of XML files; the table lists each file with its error count and the first problem.

Is this a full XSD 1.1 validator?

No. It covers the XSD 1.0 constructs listed on this page, which are what most exchange formats use. Assertions, identity constraints and substitution groups are not checked; use a full validator such as xmllint or Xerces for final certification.

What does the documentation export contain?

Every element and attribute reachable from the global elements with its path, type, occurrence range, facets such as allowed values and patterns, and the text of xs:documentation, as a printable page, an HTML file or a Markdown table.

Całkowicie za darmoBez opłat i rejestracji
Pliki zostają prywatneWszystko działa w Twojej przeglądarce
Łatwo w Twoim językuDostępne w wielu językach