Home › Developer Tools › XSD to XML Sample Generator

XSD to XML Sample Generator

Paste an XML Schema (XSD) and get a sample XML document that follows it: the right element order, required and optional elements, repeated items, attributes, enumeration values, pattern-matching strings and the target namespace. Pick the root element, decide how much optional content to include and copy or download the result.

Last updated:

The schema is parsed by your browser and never uploaded. Included or imported schema files are not fetched; paste a self-contained XSD.

Advertisement
Advertisement

How to use the XSD to XML Sample Generator

  1. Paste your XSD into the left box, open an .xsd file, or load one of the examples.
  2. Pick the root element. The generator preselects the top-level element that is not used inside others.
  3. Choose the options: include optional elements and attributes or keep it minimal, how often repeating elements appear, and realistic values or type-name placeholders.
  4. Press Generate XML (Live update also regenerates as you edit) and read any notes about unsupported parts.
  5. Copy or download the sample, then replace the values with real data.

How XSD constructs become XML

Schema constructIn the generated sample
xs:sequenceChild elements in exactly the declared order.
xs:choiceOne option (the first), with a comment listing the alternatives.
xs:allEach child once, in declaration order (any order would be valid).
minOccurs="0"Included or left out depending on the Optional items setting.
maxOccurs="unbounded"Repeated 1, 2 or 3 times according to Repeat lists.
complexContent/extensionBase type content first, then the extension's elements and attributes.
simpleContent/extensionText value of the base type plus the added attributes.
xs:enumerationOne of the allowed values; repeated elements cycle through them.
xs:patternA generated string that matches the regular expression.
fixed / defaultThe fixed value is always used; the default is used as the sample.
xs:listSpace-separated values of the item type.
xs:anyA comment marking where any element may appear.

Sample values for common built-in types

TypeSampleLexical rule
xs:date2025-03-14YYYY-MM-DD, optional time zone
xs:dateTime2025-03-14T09:30:00ZDate, T, time with seconds
xs:time09:30:00Seconds are required
xs:decimal42.50No exponent; fractionDigits limits decimals
xs:booleantruetrue, false, 1 or 0
xs:durationP2DT3HISO 8601 duration
xs:IDtask-1Unique NCName; cannot start with a digit
xs:anyURIhttps://example.com/resourceAny URI reference

To go the other way and infer a schema from existing XML documents, use the XML to XSD Generator.

Frequently asked questions

How do I generate an XML file from an XSD?

Paste the schema, choose the root element and press Generate XML. The tool walks the schema from that element, writes child elements in the order the sequences define, adds required attributes and fills each value with something that fits its type and facets.

Is the generated XML valid against the schema?

For self-contained schemas it is designed to be: element order, occurrence counts, enumerations, numeric ranges, lengths and patterns are respected. Constructs such as identity constraints (xs:key, xs:unique), assertions and xs:any wildcards are not filled in, so validate the result if it matters.

Which element is used as the root?

Any global xs:element can be the root of a document. The tool preselects a global element with complex content that no other element references, which is usually the intended root, and you can switch to any other global element in the list.

What happens with xs:choice?

The first option is used, and with comments on, a comment lists every option. When the choice repeats, later repetitions rotate through the other options so you can see them all.

Does it support xs:import and xs:include?

Referenced files cannot be fetched from the browser, so types defined in them become placeholders and a note lists the missing files. Merge the schemas into one file or paste the main schema with the needed types copied in.

How are namespaces handled?

If the schema has a targetNamespace and elementFormDefault="qualified", the document uses it as the default namespace. With unqualified local elements, only global elements get a prefix. Qualified attributes always get the prefix, and xsi:schemaLocation can be added for validation.

What does Type names as placeholders do?

Instead of sample values, each element and attribute shows its type, for example decimal or MemberIdType. This is handy as a template that shows what goes where, though the result is not valid until you fill in real values.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

XML to XSD GeneratorGenerate an XML Schema (XSD) from sample XML: types, occurrences, attributes and namespaces.XML ValidatorCheck if XML is well-formed, see the exact line and column of each error and pretty-print it.XML FormatterBeautify, validate and minify XML with a collapsible tree view.XML MinifierMinify and validate XML: strip whitespace and comments, keep CDATA, see the size savings.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 to ImagePaste a Base64 string or data URI to preview, identify and download the image.JSON CompareCompare two JSON documents and see every added, removed and changed path.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Decimal to HexConvert decimal to hex instantly with steps and signed mode.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary instantly with steps and signed mode.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.TOML to JSON ConverterConvert TOML to JSON and JSON to TOML with a full v1.0 parser and clear error lines.SQL Dialect ConverterTranslate SQL between MySQL, PostgreSQL, SQLite, SQL Server, Oracle, BigQuery and more.TSV to JSON ConverterTurn tab-separated data pasted from Excel or Sheets into a JSON array or keyed object.XLS to XLSX ConverterConvert old Excel 97-2003 .xls workbooks to modern .xlsx files in your browser, several at once.XML to Excel ConverterTurn repeating XML elements into an .xlsx spreadsheet with attributes and nested data as columns.YAML to CSV ConverterTurn a YAML list of objects into CSV with dot-notation columns, custom column order and download.DOCX to Markdown ConverterConvert Word .docx to clean Markdown with headings, lists, tables, links and images in a ZIP.ES6 to ES5 ConverterTranspile modern JavaScript (ES2015+) to ES5 with Babel: targets, module format and loose mode.JavaScript Object to JSONTurn JS object literals and Python dicts into valid JSON: quotes keys, fixes commas and values.JSON Graph VisualizerSee JSON as an interactive node graph with zoom, collapse and search; export PNG or SVG.KML ViewerOpen KML and KMZ files on an interactive map: placemarks, paths, polygons, folders, export.MySQL to PostgreSQL ConverterConvert MySQL dumps and CREATE TABLE statements to PostgreSQL: types, AUTO_INCREMENT, ENUMs, quotes.Text to CSV ConverterTurn space-aligned, fixed-width, pipe or tab separated text into clean CSV with a live preview.VCF File ViewerOpen vCard .vcf files as contact cards with photos, search and duplicate check, export CSV.XML ViewerBrowse XML as a collapsible tree with search, XPath of any node, attributes and big-file support.JSON to Go StructTurn JSON into Go structs with inferred types, nested structs and json tags.JSON to Python ClassGenerate Python dataclasses, Pydantic models or TypedDicts with type hints from JSON.JSON to C# ClassConvert JSON to C# classes or records with System.Text.Json or Newtonsoft attributes.JSON SorterSort JSON keys A-Z recursively, sort arrays by value or by a key, then pretty-print or minify.JSON to HTML TableConvert a JSON array of objects into clean HTML table code with CSS styles and a live preview.CSV to SQL ConverterConvert CSV to SQL CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.IPv4 to IPv6 ConverterConvert IPv4 to IPv4-mapped, 6to4 and NAT64 IPv6, extract IPv4 from IPv6, and get int/hex/binary.cURL to Code ConverterConvert curl commands to JavaScript fetch, Axios, Python requests, Node.js, PHP and Go code.Code to ImageTurn code into a beautiful syntax-highlighted PNG with themes, window frame and background.Excel to JSON ConverterConvert Excel sheets (XLSX, XLS, ODS) to JSON with header row, type and shape options.CSV to Excel ConverterConvert CSV files to a real .xlsx workbook with typed numbers and dates, one sheet per file.CSV SplitterSplit a large CSV into smaller files by row count, file count or column value, header kept.CSV MergerCombine many CSV files into one, matching columns by name, with dedupe and a source column.VCF to CSV ConverterConvert vCard (.vcf) contacts to CSV for Google or Outlook, or turn a CSV back into a VCF.Calendar Event (.ics) GeneratorCreate an .ics calendar invite with time zone, reminders and repeats + Google/Outlook links.CSV Column ExtractorPick, reorder and rename CSV columns, filter rows by value, and export a new CSV or JSON.
See all 129 Data & File Format Converters →