That's not really what I'm looking for, but it's pretty neat.
What I'm looking for is something like this:
my $xml_fragment = <records> <record id="001">foo</record> <record id="002">bar</record> </records>; my @nodeset = $xml_fragment =~ qx!//records[@id = '001']!; die "ids should be unique!\n" if @nodeset > 1;
Note that no quoting is needed around the xml fragment; the angle-brackets should be sufficient to identify it as an xmlnode (including the whitespace). Also note that I'm inventing a qx quote operator to wrap an xpath expression, and overloading =~ to allow me to execute the xpath expression on my $xml_fragment scalar, which contains an xmlnode data element. The return value of the qx operator is a nodeset, which is just an array of xmlnode scalars.
Doug.
In reply to Re: xQuery functionality in Perl?
by DougWebb
in thread xQuery functionality in Perl?
by DougWebb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |