On Jul 20, Manish Uskaikar said:

use XML::Parser;
my $p = XML::Parser->new(Style => 'Tree');
my $tree = $p->parsefile('tree.xml');
print $tree;

when i give the command; perl tree.pl
it tries to show me something like this:ARRAY(0x193da14)

$tree is a reference to an array.  To see what it looks like, you could do

  use Data::Dumper;
  print Dumper($tree);

From the documentation for the 'Tree' style, I see:

  So for example the result of parsing:

    <foo><head id="a">Hello <em>there</em></head><bar>Howdy<ref/></bar>do</foo>

  would be:

             Tag   Content
  ==================================================================
  [foo, [{}, head, [{id => "a"}, 0, "Hello ",  em, [{}, 0, "there"]],
              bar, [         {}, 0, "Howdy",  ref, [{}]],
                0, "do"
        ]
  ]

  The root document "foo", has 3 children: a "head" element, a "bar" ele-
  ment and the text "do". After the empty attribute hash, these are rep-
  resented in it's contents by 3 tag-content pairs.

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to