XML Formatting Principles
XML formatting parses XML structure and applies indentation and line break rules to make documents clean and readable. Process: XML parser builds DOM tree → traverses nodes (elements, attributes, text, comments) → adds indentation by hierarchy → formatted output. Formatting rules: elements on separate lines, attribute alignment or line breaks, preserve text node whitespace, comment alignment, CDATA handling, namespace prefix handling.