in reply to Reading XML LibXML
i would put the content of $tmpinfo into the hash later, but it tells me $tmpinfo is uninitialized?
Maybe you want \@tmpinfo ?
use Basic debugging checklist item 4 ( Dumper ) to ddumperBasic debugging checklist up \@tmpinfo before/inside/after the LOOP
Works for me :)
#!/usr/bin/perl -- use strict; use warnings; use XML::LibXML 1.70; ## for load_html/load_xml/location use Data::Dump; my $xml=q{<table> <Entry No="1"> <lastname_>Dasd</lastname_> <firstname_>Dasd</firstname_> <street_>Dasd</street_> <houseno_>12</houseno_> <zip_>1231</zip_> <city_>Dasd</city_> <sex_>maennlich</sex_> <marital_>geschieden</marital_> <character_>Brille Sommersprossen</character_> <description_>asdas </description_> </Entry> <Entry No="2"> <lastname_>Dasd</lastname_> <firstname_>Dasd</firstname_> <street_>Dasd</street_> <houseno_>12</houseno_> <zip_>1231</zip_> <city_>Dasds</city_> <sex_>maennlich</sex_> <marital_>geschieden</marital_> <character_>Brille Sommersprossen</character_> <description_>asdas </description_> </Entry> </table> }; my $tree = XML::LibXML->new( qw/ recover 2 / )->load_xml( string => $x +ml ); my @nodeboks; for my $sample ( $tree->findnodes('/table/Entry') ){ for my $content ( $sample->findnodes('*') ){ print $content->nodePath, "\n"; push @nodeboks, $content->textContent; } } dd\@nodeboks; __END__
|
|---|