Text to XML converter

Convert plain key:value text into well-formed XML documents. Specify a root element name. Runs entirely in your browser.

Text input

XML output

How text to XML works

Each line with a colon or an equals sign becomes one element. The text before the separator becomes the element name, and the text after it becomes the content. Spaces in a name are replaced with underscores, and every element is wrapped in the root name you choose. The default root name is record.

Example

name: John Doe age: 30

with the root name person converts to:

<?xml version="1.0" encoding="UTF-8"?> <person> <name>John Doe</name> <age>30</age> </person>

Limitations

  • Lines without a colon or an equals sign are skipped.
  • Only the first colon on a line is the separator, so values can contain colons.
  • Every value is text. Numbers and booleans are not typed.
  • Element names are not checked. A name that starts with a digit produces invalid XML.