in reply to Re^2: Mixed XML content with XML::LibXML
in thread Mixed XML content with XML::LibXML
This does the trick. The particular data set I'm using should never have more than one text value mixed in with the child nodes.use XML::LibXML; my $file = $ARGV[0]; print $file."\n"; &parse($file); sub parse { my $filename = shift; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file("$filename"); foreach my $node ($doc->findnodes('/root/node')) { print "textval :".$node->findnodes('./text()')->to_literal."\n"; } }
|
|---|