XML test data generator

Need XML for testing a parser, an import or a prototype? This tool makes a document with British names, email addresses, addresses, amounts and lorem ipsum. Choose the fields and the number of items and the XML appears straight away.

Fields

How it works

  1. Choose what you need

    The number of paragraphs, elements or records, and which parts or fields go in.

  2. Ready at once

    The text or code appears immediately. Not happy with it? Click New variant for different content.

  3. Copy or download

    Copy with one click or save it as a file.

Options

  • Fields: id, name, email, phone, street, postcode, city, birthdate, amount, active and text, each on or off. The labels in the form are Name, Email, Phone, House number + street, City, Date of birth, Amount, Active (true/false) and Lorem ipsum text.
  • Root element and Element per item: the names of the outer element and of every record, people and person by default. Names that aren't valid XML names fall back to items and item.
  • id as an attribute: writes <person id="1"> instead of an <id> child element.
  • Number: from 1 to 1,000 items.

What it produces

With the default fields and two items, the document is:

<?xml version="1.0" encoding="UTF-8"?>
<people>
  <person>
    <id>1</id>
    <name>Ella Robinson</name>
    <email>ella.robinson@example.com</email>
    <city>York</city>
    <amount>411.38</amount>
    <active>false</active>
  </person>
  <person>
    <id>2</id>
    <name>Alfie Taylor</name>
    <email>alfie.taylor@example.org</email>
    <city>Liverpool</city>
    <amount>104.83</amount>
    <active>true</active>
  </person>
</people>

Set Element per item to row, tick id as an attribute and each record opens with <row id="1"> and loses its <id> child. Special characters are escaped, so the output stays valid XML.

Not real data

Names, addresses and phone numbers are made up and don't belong to real people; email addresses use example domains. The records come from a fixed seed, so you see the same first set each time you open the page and New variant gives a different one. To check or reformat the result, use the XML formatter. Need JSON instead? Use the JSON test data generator. For loose placeholder text, there is the lorem ipsum generator.

Frequently asked questions

Is the XML always valid?

It is always well-formed: one root element, a `<?xml version="1.0" encoding="UTF-8"?>` declaration, every record in its own element, and the characters `&`, `<`, `>` and `"` escaped as `&amp;`, `&lt;`, `&gt;` and `&quot;`. There is no DTD or schema, so there is nothing to validate against beyond that.

Why did my root element turn into "items"?

A name has to start with a letter or an underscore and may then contain letters, digits, dots, hyphens and underscores. A name such as `1 bad`, with a space and a digit first, isn't a valid XML name, so the tool falls back on `items` for the root and `item` for each record instead of making broken XML.

What does "id as an attribute" do?

It moves the id out of the record's content and into the opening tag: `<person id="1">` instead of `<person><id>1</id>`. All other fields stay as child elements.

How are true and false and numbers written?

As plain text: `<active>false</active>` and `<amount>411.38</amount>`. XML has no types, so a parser or a schema decides how to read them.

Is anything uploaded?

No. The document is generated in your browser and nothing is sent anywhere.