in reply to Re^2: Problem getting fields out of an XPath node list
in thread Problem getting fields out of an XPath node list
Finding the value of the list element is not really helping you as the table is not an element of the list. If you know there is only one table, this verbose example may help:
# get all the tables my @tables = $tree->findnodes('//table'); # get the first table my $table = $tables[0]; # get all the rows of first table my @rows = $table->findnodes('tr'); # loop through the rows for my $row ( @rows ) { # get all the cells my @cells = $row->findnodes('td'); # loop through the cells for my $cell ( @cells ) { print $cell->as_text, "\n"; } } Output: Remote Host Port Number 192.5.5.241 8091
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Problem getting fields out of an XPath node list
by ejc1 (Novice) on Mar 29, 2016 at 16:27 UTC | |
by tangent (Parson) on Mar 29, 2016 at 17:19 UTC |
In Section
Seekers of Perl Wisdom