Formateador y Minificador de XML
Imprime de forma bonita o minifica XML, con validación y ancho de indentación configurable.
Respuesta rápida: Formateador y Minificador de XML: aplica formato legible o minifica XML, con validación y ancho de sangría configurable. Funciona íntegramente en el navegador, gratis y sin registro.
Última actualización
Bueno saber
Because this formatter uses the browser's own DOMParser, it validates well-formedness — balanced tags, quoted attributes, legal characters — the same way your app's XML parser will. That makes it a fast sanity check before you ship a config, a sitemap, or a SOAP request: if it won't format, it won't parse in production either.
It does not validate against a schema, though. An XSD or DTD defines which elements are allowed where and what types their values must be; checking that requires a much heavier validator. So a document can format perfectly here yet still be rejected by a strict service that enforces a schema. Use this for structure and readability, and a dedicated schema validator for contract compliance.
The minify mode strips the whitespace between tags, which is exactly what you want for RSS feeds, SVG assets, or SOAP payloads where every byte counts on the wire. Be careful with elements whose whitespace is significant — <pre>-style content or anything marked xml:space="preserve" — since DOMParser normalizes text-node whitespace per the spec. Wrap literal content in CDATA when you need it kept verbatim.
Namespaces, the XML declaration, and CDATA sections are preserved, so SVG and SOAP round-trip safely. If you actually need to move the data into JSON or YAML rather than just pretty-print it, reach for the JSON ↔ XML converter instead.
Preguntas frecuentes
- ¿Validará contra un esquema XML (XSD)?
- No — solo comprueba la corrección (etiquetas correctas, comillas balanceadas, caracteres válidos). La validación XSD necesita una biblioteca mucho más grande; usa una herramienta de escritorio para eso.
- ¿Es seguro para SOAP / RSS / SVG?
- Sí — los tres son XML válidos. El formateador preserva los espacios de nombres, secciones CDATA y la declaración XML.
- ¿Mi XML será subido?
- No — DOMParser se ejecuta en el navegador. Nada sale de tu dispositivo.
- ¿Por qué la salida a veces se ajusta de manera diferente a lo esperado?
- DOMParser normaliza los espacios en blanco dentro de los nodos de texto según la especificación XML. Usa una sección CDATA o cambia <code>xml:space="preserve"</code> si necesitas fidelidad exacta en los espacios.
- ¿Puedo minificar un archivo XML grande?
- Sí — archivos de hasta varios megabytes se minifican al instante. Archivos más grandes (50 MB+) pueden acercarse a los límites de memoria del navegador.