A one-line note document
- XML to format
- <note><to>Tove</to><from>Jani</from></note>
- Indent
- 2 spaces
Result Formatted XML: <note>
<to>Tove</to>
<from>Jani</from>
</note>
Elements: 3
Deepest nesting: 2
Output lines: 4
Comments: 0
Input characters: 43
Output characters: 50
- Split the input into 8 nodes: tags, text, comments, CDATA and declarations.
- Checked that every opening tag has a matching closing tag (3 elements, deepest nesting 2).
- Wrote one node per line, indented by 2 spaces per level; short text-only elements stay on one line.
The root goes on its own line and each short child element keeps its text inline, indented two spaces.