i have tried the use Data::Dumper; It now shows me the entire contents but i want to have these contest as an array, is there a way i can access this array. i want to see which element is occuring in what sequence and then i want to extract the data and attribute and values to form some other xml document. Regards, Manish U
________________________________ From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED] Sent: Thu 7/21/2005 12:16 AM To: Manish Uskaikar Cc: beginners@perl.org Subject: Re: Help regarding XML::Parser 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