thanks everyone for their input....
after trying a few solutions, i guess I shall adopt the below approach....
use XML::Parser::PerlSAX; use XML::Handler::YAWriter; my $xmlquery = qq(<AIRAVAALABILTY> <AIRAVL> <AIRAVL012U>01MAY</AIRAVL0 +12U> <AIRAVL0145>SIN</AIRAVL0145> <AIRAVL018B>HKG</AIRAVL018B> <AIRAV +L007V>Y</AIRAVL007V> <AIRAVL012G></AIRAVL012G> </AIRAVL> </AIRAVAALAB +ILTY>); my $ya = new XML::Handler::YAWriter( 'Output' => new IO::File ( ">-" ), 'Pretty' => { 'NoComments'=>1, 'PrettyWhiteIndent'=>1, 'NoWhiteSpace'=>1, 'PrettyWhiteNewline'=>1, } ); my $perlsax = new XML::Parser::PerlSAX( 'Handler' => $ya); my $result = $perlsax->parse(Source => { Encoding => 'ISO-8859-1', Str +ing => "$xmlquery" }); print qq($result);
which in turn prints out
<AIRAVAALABILTY> <AIRAVL> <AIRAVL012U>01MAY </AIRAVL012U> <AIRAVL0145>SIN </AIRAVL0145> <AIRAVL018B>HKG </AIRAVL018B> <AIRAVL007V>Y </AIRAVL007V> <AIRAVL012G> </AIRAVL012G> </AIRAVL> </AIRAVAALABILTY>

In reply to Re: Indenting XML by uzzikie
in thread Indenting XML by uzzikie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.