Convert XML to YAML
Turn XML files into YAML. The root element becomes the top key; attributes become keys starting with @, repeated elements become a list while a lone one stays a single value, and text beside child elements goes under #text.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop XML files on the dialor turn it to pick what to do
XML as a YAML file.Elements become keys, attributes get an @ prefix, and values stay text.
What you get
One YAML file with the same data as the XML. The root element becomes the top key, and the elements inside it become keys below it.
Attributes become keys that start with @. Text that sits beside child elements goes under a key named #text.
How elements are mapped
Repeated elements become a list. An element that appears once stays a single value, not a list of one.
Every value stays text, so numbers and dates in the XML are not turned into other types. An empty element becomes null.
What it leaves behind
Comments and processing instructions are dropped. The position of text between child elements is lost too, because the text is gathered under #text rather than kept in its place.
To go the other way, use YAML to XML.
When it stops
If the XML cannot be parsed, the conversion stops with
input_corrupted. No YAML file is produced in that case.
XML and YAML.What each format is.
The formats
XML
XML documents and data.
- Extensions
- .xml
- MIME type
- application
/xml - Kind
- Text and data
YAML
YAML configuration and data files.
- Extensions
- .yaml .yml
- MIME type
- application
/yaml - Kind
- Text and data
In your code.The same XML to YAML conversion through the API, for your app or your agent.
$ cv convert report.xml report.yaml$ cv convert report.xml report.yamlQuestions.What people ask about XML to YAML.
Each attribute becomes a key that starts with @. It sits alongside the keys for the child elements.
No. Only repeated elements become a list. A lone element stays a single value.
No. Every value stays text, including values that look like numbers.
No. Comments and processing instructions are lost in the YAML file.