I must be missing something about how to use XML::XPath::XMLParser::as_string. Here's what I am doing.
The above code works fine as far as I can tell. A list if IP addresses is displayed separated by a ':'. Next I do this ...my $xp = XML::XPath->new(xml => $fpdomaininfo ); my $nodeset = $xp->find('//cidr-map'); foreach my $node ($nodeset->get_nodelist) { my $node_name = $node->findvalue ( '@name' ); my $ips_as_string = XML::XPath::XMLParser::as_string($node); $ips_as_string =~ s/ /:/g; # this prints nice list of ipaddresses # 127.0.0.1:198.168.1.1:198.168.1.2 print "<hr><hr>" . __LINE__ . "<br>" . $ips_as_string . "<hr>< +hr>\n";
The output is ...my @ips = split /:/, $ips_as_string; # Dumper outputs this ... # 589 # $VAR1 = ' print "<hr><hr>" . __LINE__ . "<br>" . Dumper( @ips ) . "<hr>< +hr>\n";
... next I do this ...589 $VAR1 = '
... where the output include XML tags :/# this prints crap if XML in it !!! for my $ip ( @ips ) { print "$ip<br>"; }
Is there some subtle point to XML::XPath::XMLParser::as_string I am missing?
In reply to Trouble using XML::XPath::XMLParser::as_string ? by Plankton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |