UltKit

TXT to XML Converter

A text file with one record per line is easy to write and hard to import into systems that expect tagged data. Upload the .txt and get well-formed XML with one element per line and the header names as tags.

Data Converter

or drop CSV, TSV, TXT … files here ·

Max 95 MB per file· Up to 20 files· Deleted after 30 minutes

Output

Files are processed on our servers and deleted after 30 minutes.

How to use this tool

  1. 1

    Upload the delimited text

    Add a .txt file whose first line names the columns, or up to 20 files of 95 MB each. Delimiter is on Auto detect.

  2. 2

    Name the outer element

    Under Advanced settings, XML root tag is set to records on this page. Change it to whatever the receiving system expects, such as products or employees.

  3. 3

    Convert to XML

    Press Convert to XML. Pretty print is on, so the file is indented and easy to check in any text editor or browser.

Each line of the text file becomes one row element, each column becomes a tag named after its header, and everything sits inside the root tag you choose.

Why turn a TXT file into XML

Text files with separators are what scripts, scanners and older databases produce by default. XML is what many receiving systems were designed around: product catalogs, library and publishing tools, translation software and configuration loaders that read elements by name. XML 1.0 became a W3C Recommendation in February 1998 as a simplified form of SGML, and a great deal of enterprise software from the years that followed still speaks it.

The gap between the two is mostly mechanical, which is why doing it by hand in a text editor is a waste of an afternoon. Typical jobs are a warehouse export that has to become an XML import for a web shop, a list of glossary terms for a translation tool, or test records for an application that reads XML fixtures. When the source is already comma-separated, CSV to XML is the matching page.

Text layouts the TXT to XML converter can split

from ↓ · to →XMLJSONCSV
Comma ,Comma , to XML: yesComma , to JSON: yesComma , to CSV: yes
Semicolon ;Semicolon ; to XML: yesSemicolon ; to JSON: yesSemicolon ; to CSV: yes
TabTab to XML: yesTab to JSON: yesTab to CSV: yes
Pipe |Pipe | to XML: yesPipe | to JSON: yesPipe | to CSV: yes
Single spaceSingle space to XML: yesSingle space to JSON: yesSingle space to CSV: yes
Fixed-width columns– Fixed-width columns to XML: no– Fixed-width columns to JSON: no– Fixed-width columns to CSV: no
supported not offered**Delimiter** on Auto detect recognizes the separator from the file; pick it yourself if a value contains the character Auto chose. Columns aligned only by position, with no separator, cannot be split.

TXT to XML example output

Input lines sku|name|price and A-1001|Desk lamp|24.90, converted with XML root tag records and Pretty print on
<records>
  <row>
    <sku>A-1001</sku>
    <name>Desk lamp</name>
    <price>24.90</price>
  </row>
</records>

Because header names turn into tags, they have to be valid XML names: start with a letter or underscore and avoid spaces and symbols. A header like Unit Price is better written as unit_price before converting. If the receiving system prefers JSON after all, TXT to JSON uses the same header line as keys, and the data converter lists every other target.

Plain text and XML format facts

TXT

Plain text

A TXT file contains only plain characters with no formatting, fonts, images or layout. Modern text files are usually encoded in UTF-8, which covers every language, though older files may use other encodings and show garbled characters. Plain text is tiny, never becomes obsolete and opens on every device, from phones to servers. It cannot hold bold text, tables or pictures, so structure must be expressed with spacing or simple markup.

Compression
–
Transparency
–
Animation
–
Introduced
–
TXT converter

XML

Extensible Markup Language

XML is a markup language for structured data published by the W3C in 1998. It uses nested tags with attributes and supports schemas, namespaces and validation, which makes it robust for complex documents. It underlies RSS feeds, SVG, Office documents, sitemaps and many enterprise and government data exchanges. XML is verbose compared with JSON, but every programming language and many spreadsheet tools can read it.

Compression
–
Transparency
–
Animation
–
Introduced
1998 · W3C
XML converter

Delimited text becomes XML when a flat export has to enter a system that only takes tagged records: a CMS or shop import, a configuration loader, or an integration whose other side was built around XML long before JSON.

TXT to XML questions

Does my text file need a header line?

It should have one, because the header names become the element names around every value. If your export starts straight with data, add a line such as sku|name|price at the top in a text editor before converting.

Can I rename the outer element from records?

Yes. XML root tag accepts up to 64 characters starting with a letter or underscore, followed by letters, digits, dots, hyphens or underscores. Each line of the text file is written as a row element inside it.

What happens to & and < characters inside my values?

They are escaped as &amp; and &lt;, as the XML specification requires, so a company name like Smith & Sons does not break the file. Any XML parser turns them back into the original characters when it reads the data.

Why is the XML so much larger than the text file?

Every value is wrapped in an opening and a closing tag that repeats the column name, and Pretty print adds indentation on top. A file several times the size of the source is normal. Turn Pretty print off for a compact version.

Can the values be written as attributes instead of child elements?

No. The converter writes each value as its own child element, the layout most import tools accept. If a partner specifically needs attributes, an XSLT stylesheet can reshape the converted file in one pass.

My file comes from an old Windows program. Will accented names survive?

Set Text encoding to Windows-1252 before converting, since many older Windows programs wrote that code page instead of UTF-8. If the names still look wrong, try ISO-8859-1, the other common Western code page.