Convertee/Guide

How to Convert XML to YAML for Configuration Files

Last updated: 2026-04-15

XML was the default configuration format for Java, .NET, and enterprise systems for two decades. Modern frameworks have largely moved to YAML: Spring Boot accepts application.yml alongside application.xml, and Kubernetes uses YAML exclusively. If you are migrating a project or consolidating config formats, converting XML to YAML is a common first step.

Step-by-Step: Convert XML to YAML

  1. Open Convertee and select XML as the source and YAML as the target.
  2. Paste your XML configuration or drop a .xml file.
  3. Adjust YAML options: indent width, whether to quote strings, and how to handle XML attributes.
  4. Click Convert (Cmd+Enter).
  5. Copy or download the YAML output.

The conversion is entirely client-side. Your XML stays in the browser.

Before / After Example

Input XML (Spring-style):

<configuration>
  <server>
    <port>8080</port>
    <host>0.0.0.0</host>
  </server>
  <database>
    <url>jdbc:postgresql://localhost/mydb</url>
    <pool-size>5</pool-size>
  </database>
</configuration>

Output YAML:

configuration:
  server:
    port: 8080
    host: "0.0.0.0"
  database:
    url: "jdbc:postgresql://localhost/mydb"
    pool-size: 5

Understanding the Mapping

XML elements map to YAML keys. Nested elements become nested mappings. Text content becomes the value. XML attributes are handled by prefixing attribute names with @ (a common convention also used by libraries like Jackson and xmldom).

The XML specification (W3C XML 1.0) allows mixed content, namespaces, and processing instructions that have no direct YAML equivalent. Convertee handles the common cases; for complex XML with mixed content, manual review of the output is recommended.

Common Migration Scenarios

Gotchas

Frequently Asked Questions

How are XML attributes represented in YAML?
XML attributes are prefixed with @ in the YAML output (e.g., <server port='8080'> becomes server: { '@port': 8080 }). This is a widely used convention in XML-to-JSON/YAML converters.
Does this work with Spring Boot configuration files?
Yes. Convertee handles standard Spring XML configuration and produces YAML that follows Spring Boot's application.yml conventions. Review the output for Spring-specific property mappings that may need manual adjustment.
What happens with XML namespaces?
Namespace prefixes are preserved in the YAML keys (e.g., xs:element becomes a key named 'xs:element'). For most configuration file migrations, namespaces are not present and this is not a concern.

Related Guides

Ready to convert? Try it now — no sign-up required.

Open Converter