Is there an easy way to indent an unindented XML file?
Of course, significant whitespace between two adjacent elements or in mixed content should not be obscured or lost
The data have an encoding ISO-8859-1 and contain tons of XML entities defined in a DTD with external entity declarations in a subdirectory
sample input
<?xml version="1.0" encoding="ISO-8859-1"?><root><para><pnum>1</pnum><ptext>This is a sample of a very specific text <emph>called</emph> <term>description</term> which has 2 subtypes: <list><item><term>1.</term><p>precise</p></item><item><term>2.</term><p>fuzzy</p></item></list></ptext></para></root>
The output should look like this:
<?xml version="1.0" encoding="ISO-8859-1"?> <root> <para> <pnum>1</pnum> <ptext>This is a sample of a very specific text <emph>called</ +emph> <term>description</term> which has 2 subtypes: <list> <item> <term>1.</term> <p>precise</p> </item> <item> <term>2.</term> <p>fuzzy</p> </item> </list> </ptext> </para> </root>
In reply to Indent XML data by LexPl
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |