Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: understanding XML::Parser

by Thelonius (Priest)
on Jul 17, 2006 at 05:57 UTC ( [id://561671]=note: print w/replies, xml ) Need Help??

in reply to understanding XML::Parser

When I use strict; I get the error Global symbol "@tree" requires explicit package name. This is a good clue.

When I change

my $node1 = ${$tree[0]}{name};
my $node1 = ${$tree->[0]}{name};
everything works.

$tree[0] is the zero'th element of @tree.

$tree->[0] is the zero'th element of tree that is referenced by $tree.

Replies are listed 'Best First'.
Re^2: understanding XML::Parser
by rsiedl (Friar) on Jul 17, 2006 at 07:13 UTC

    Is there an easier way to get a value if I know only the name of the element?

    For example: if i want the value of count which resides in search_results?

      Based on my XML decision tree, you may want to use a technology that abstracts the XML tree such that it gives you XPath capabilities. I just load the entire XML file into memory, then ask the object to give me the elements that match my criteria.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://561671]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-06-17 13:20 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.