Convert YAML to XML
Turn YAML files into XML. Objects become elements inside one root element and every value becomes text, with characters a tag name cannot hold turned into underscores.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop YAML files on the dialor turn it to pick what to do
YAML data as an XML document.Objects become elements under one root, and every value becomes text.
What you get
One XML file. Each object becomes elements inside a single root element, and each value is written as text. A list repeats its element once per item.
Keys that contain characters a tag name cannot hold are written with underscores in their place.
Attributes and text
A key that starts with @ becomes an attribute. When the value is a list or an object, the attribute holds it as JSON text. A key named #text becomes the element's own text.
What changes or is lost
Values such as yes, on, 0755 and dates stay text, so they are not turned into other types. Comments are dropped, and aliases are expanded into their full values.
An empty list disappears, because a list is written by repeating its element. A list of lists is flattened. A merge key (<<) is kept as an ordinary key and is not merged.
If the file holds several documents, they become a list.
When it stops
The conversion stops with
input_corruptedwhen the YAML file cannot be parsed. To go the other way, use XML to YAML.
YAML and XML.What each format is.
The formats
YAML
YAML configuration and data files.
- Extensions
- .yaml .yml
- MIME type
- application
/yaml - Kind
- Text and data
XML
XML documents and data.
- Extensions
- .xml
- MIME type
- application
/xml - Kind
- Text and data
In your code.The same YAML to XML conversion through the API, for your app or your agent.
$ cv convert report.yaml report.xml$ cv convert report.yaml report.xmlQuestions.What people ask about YAML to XML.
No. Comments are dropped. Aliases are expanded.
Yes. Start a key with @ and it becomes an attribute. If its value is a list or an object, the attribute holds it as JSON text.
No. Every value becomes text. Values such as yes, on, 0755 and dates stay as written.
The documents become a list, and a list repeats its element in the XML.