XML::Simple already does a primitive pretty print in XMLout(). Here is how it's used with your data:
use XML::Simple; my $doc = XMLin 'air.xml', forcearray => 1; print XMLout $doc, xmldecl => 1, rootname => 'AIRAVAALABILITY'; __END__ prints: <?xml version='1.0' standalone='yes'?> <AIRAVAALABILITY> <AIRAVL> <AIRAVL007V>Y</AIRAVL007V> <AIRAVL018B>HKG</AIRAVL018B> <AIRAVL012U>01MAY</AIRAVL012U> <AIRAVL012G></AIRAVL012G> <AIRAVL0145>SIN</AIRAVL0145> </AIRAVL> </AIRAVAALABILITY>
Update: fixed up root tag
After Compline,
Zaxo
In reply to Re: Indenting XML
by Zaxo
in thread Indenting XML
by uzzikie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |