Looking to return the full xpath from a general xpath that may grab multiple results.
The search string would be something general like this: /myXmlPath/@myValue
The contained xml nodes might look something like this:
<myXmlPath someAttribute="false" myValue="">
<myXmlPath someAttribute="true" myValue="">
Perl code something like this:
use XML::LibXML;
use XML::XPath::XMLParser;
my $filepath = "c:\\temp\\myfile.xml";
my $parser = XML::LibXML->new();
$parser->keep_blanks(0);
my $doc = $parser->parse_file($filepath);
@myWarn = ('/myXmlPath/@myValue');
foreach(@myWarn) {
my $nodeset = $doc->findnodes($_);
foreach my $node ($nodeset->get_nodelist) {
my $value = $node->to_literal;
print $_,"\n";
print $value," - value \n";
print $node," - node \n";
}
}
I'd like to be able to evaluate the returned full path values from the xml. This code works fine when I'm using it to lookup general things in an xpath, but would be more ideal if I could get at other data from the nodeset result.