Skip to content
faker.tools
All 79

Plate IV · Developer, API & Database Seeding Utilities

XML, YAML & TOML Generator

The same records in four configuration formats.

xml
<?xml version="1.0" encoding="UTF-8"?>
<users count="5">
  <user>
    <id>1</id>
    <fullName>Alice Young</fullName>
    <email>alice.young@example.com</email>
    <city>Boise</city>
    <isActive>true</isActive>
    <createdAt>2026-01-30T23:11:06Z</createdAt>
  </user>
  <user>
    <id>2</id>
    <fullName>Ryan Lopez</fullName>
    <email>ryan.lopez@example.com</email>
    <city>Brooklyn</city>
    <isActive>true</isActive>
    <createdAt>2026-04-09T23:11:06Z</createdAt>
  </user>
  <user>
    <id>3</id>
    <fullName>Linda Anderson</fullName>
    <email>linda.anderson@example.com</email>
    <city>Savannah</city>
    <isActive>false</isActive>
    <createdAt>2026-04-21T23:11:06Z</createdAt>
  </user>
  <user>
    <id>4</id>
    <fullName>Iris Martin</fullName>
    <email>iris.martin@example.com</email>
    <city>Portland</city>
    <isActive>true</isActive>
    <createdAt>2024-05-09T23:11:06Z</createdAt>
  </user>
  <user>
    <id>5</id>
    <fullName>Thomas Moore</fullName>
    <email>thomas.moore@example.com</email>
    <city>Boise</city>
    <isActive>true</isActive>
    <createdAt>2025-08-04T23:11:06Z</createdAt>
  </user>
</users>
43 lines · 1.1 KBGenerated in your browser · XML, YAML & TOML Generator

Configuration parsers are where quoting rules bite. YAML reads an unquoted yes as a boolean and 1.2.3 as a string; XML needs & escaped; TOML wants everything quoted. Generating the same records in all four shows exactly where each format differs.

What you can control

  • Four formats from one field list, so you can compare how the same record is expressed.
  • YAML scalars are quoted only when the value would otherwise be misread — the rule most hand-written YAML gets wrong.
  • XML escapes ampersands and angle brackets, and arrays become repeated <item> elements.
  • Java properties output flattens everything to entity[0].field=value, matching how Spring reads indexed properties.

Testing ideas

  • Parsers. Generate the same records in XML, YAML, TOML and .properties and run each through your config loader or import job.
  • YAML gotchas. Check how your parser treats values like no, on and 1e3, which YAML 1.1 parsers read as booleans and numbers.
  • XML escaping. Names with ampersands and apostrophes test entity escaping in your XML pipeline.
  • Declarations. Toggle the XML declaration and YAML document marker to test parsers that are strict about them.

What this is not

The XML output has no namespace or schema declaration. Add an xsi:schemaLocation yourself if you are testing schema validation.

Questions

Why are some YAML values quoted and others not?

Because YAML would misparse them otherwise. A value starting with a digit, containing a colon, or reading as a boolean gets quoted; everything else does not need it.

Can I validate the XML against a schema?

Not out of the box — there is no XSD reference. Add one yourself, or use the output to check your parser rather than your schema.

What is the properties format for?

Java and Spring configuration. The indexed `entity[0].field` syntax is how Spring Boot binds a list of objects from a flat properties file.

Next in Developer

All 11 →