in reply to Re: xQuery functionality in Perl?
in thread xQuery functionality in Perl?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: xQuery functionality in Perl?
by jdporter (Paladin) on May 19, 2005 at 17:23 UTC | |
by rg0now (Chaplain) on May 20, 2005 at 17:01 UTC | |
by DougWebb (Initiate) on May 19, 2005 at 18:22 UTC | |
by jdporter (Paladin) on May 19, 2005 at 18:38 UTC | |
|
Re^2: xQuery functionality in Perl?
by dimar (Curate) on May 20, 2005 at 09:09 UTC |