TsWorks Tools
All tools (39)

YAML to XML

Convert YAML into well-formed XML with a root you choose.

Indent

Several documents come out as an array.

Paste YAML. Anchors, multi-line scalars and multi-document streams all work.

YAML to XML

Convert YAML into well-formed XML, with a root element you choose and indentation you control. Anchors, multi-line scalars and multi-document streams are all handled by a real YAML parser, so what you get is what your CI would have read.

How the structures map

A mapping becomes child elements. A sequence repeats the parent's element name once per item, which is how XML expresses a list - there is no wrapper element around the group. A key beginning with@ becomes an attribute rather than a child, which gives you a way to produce attributes from YAML at all.

Keys that are not valid XML names

XML element names cannot start with a digit or contain spaces, and YAML keys can do both. Those are rewritten deterministically - characters XML rejects become underscores, and a leading digit gets an underscore in front - so the document parses and the mapping stays stable between runs.

Related tools