Indent with 2 spaces
- Input
- <a><b>1</b><c/></a>
- Expected output
- <a> | __<b>1</b> | __<c/> | </a>
Each vertical bar is a line break and each underscore is one indentation space.
format xml online
Paste the XML, pick Format or Minify and the result shows at once. The only thing that changes is the whitespace between elements; whatever sits inside the elements stays exactly as it came in.
Each vertical bar is a line break and each underscore is one indentation space.
Only the space between elements goes away (the vertical bar marks a line break); the text t stays inside a.
Text with a tag in the middle is not re-indented.
References are neither resolved nor rewritten.
The result is written in UTF-8, so the declaration now tells the truth.
Drop the file on the upload area or pick it with the button. The tool detects the encoding (UTF-8, UTF-16 or the one declared in the header, such as ISO-8859-1), shows the formatted text and builds the tree. You can also paste the content. Any text editor or browser can open XML, but only here do you get formatting, a tree, search and NF-e reading in one place with nothing to install.
No, because only the space between elements is rebuilt and only where it carries no meaning. Elements with text, mixed content or xml:space="preserve" come out identical.
It depends on indentation and depth. The tool sample NF-e is 6,086 bytes with 2-space indentation, 7,992 with 4 spaces and 3,964 minified, which is 35% and 50% smaller. The page shows the size before and after, in UTF-8 bytes.
Almost always because of a well-formedness error, such as a tag that is never closed. The red banner points at the line and column; fix it there and the formatting appears by itself.