Say I had the following XML object:
var x =
<x>
<y>Y</y>
<z>Z</z>
</x>
And say I wanted to retrieve the child <y/> and </z> elements.
In XPath, I would do something like the following:
/x/*[name()='y' or name()='z']
I have tried to do what might seem to be the equivalent in E4X:
x.*.(name()=="y" || name()=="z");
However, I get the following exception message:
"uncaught JavaScript runtime exception: ReferenceError: "name" is not
defined."
Is this a limitation of the Rhino library? Or am I trying something that
isn't really allowed in E4X?
Grateful for any help,
Kieran
NB To clarify, here's a printout of an attempt to run this via the console:
[kieran]$ java -jar ./js.jar
Rhino 1.7 release 1 2008 02 14
js> var x =
<x>
<y>Y</y>
<z>Z</z>
</x>
js> x.*.(name()=="y" || name()=="z");
js: "<stdin>", line 7: uncaught JavaScript runtime exception:
ReferenceError: "name" is not defined.
at <stdin>:7
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino