I must be missing something about how to use XML::XPath::XMLParser::as_string. Here's what I am doing.
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 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 @ips = split /:/, $ips_as_string;
# Dumper outputs this ...
# 589
# $VAR1 = '
print "<hr><hr>" . __LINE__ . "<br>" . Dumper( @ips ) . "<hr><
+hr>\n";
The output is ...
589
$VAR1 = '
... next I do this ...
# this prints crap if XML in it !!!
for my $ip ( @ips ) { print "$ip<br>"; }
... where the output include XML tags :/
Is there some subtle point to XML::XPath::XMLParser::as_string I am missing?