Re: simple XML::XPath question
by Yanick Champoux other posts by this author
Jul 13 2006 6:27PM messages near this date
view in the new Beta List Site
RE: simple XML::XPath question
|
Re: simple XML::XPath question
& XSLT On Thursday 13 July 2006 20:27, Lev Lvovsky wrote:
> say that this is my xml file which I'd like to parse:
>
> <CompanyData>
> <Owner>Joe Smith</Owner>
> [..]
>
> What I'd like to do, is get all this stuff into a hash like this one:
>
> $DataList{first} = ("first_element1", "...", "...");
>
> Or perhaps a hash of hashes...
Have you considered using XML::Simple? It's not XPath-based, but it seems to
be doing exactly what you are looking for:
use XML::Simple;
use Data::Dumper;
undef $/;
my $parser = XML::Simple-> new;
my $xml = $parser-> XMLin( <DATA>, KeyAttr => 'Id' );
print Dumper( $xml );
__DATA__
<CompanyData>
<Owner> Joe Smith</Owner>
...
Joy,
`/anick
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Lev Lvovsky
Mark - BLS CTR Thomas
Yanick Champoux
Lev Lvovsky
|