Subj : Re: E4X: Filtering Predicate Operator
To : McKinley, Richard
From : McKinley, Richard
Date : Mon Aug 23 2004 07:39 pm
This is strange. Some principle must be lost on me. Using this:
var tree =
;
the node gets found. Using this:
var tree =
;
the node does not get found. Why would that be?
Thanks,
McKinley
McKinley, Richard wrote:
> I have tried this two different ways. The following code matches the
> examples in section 11.2.4 very closely. The results I want are all
> nodes with a level of 1:
>
>
>
>
>
>
>
>
>
> See the code below. Why am I only getting the first node with level="1"?
>
>
>
> var tree =
>
>
>
>
>
>
>
>
>
>
>
> ;
> var nodesWithFilteringPredicateOperator = tree..node.(@level == 1);
> out.println(nodesWithFilteringPredicateOperator.toXMLString());
> /* output:
>
>
>
>
> */
>
> var nodesWithForEach = new XMLList();
> var i = 0;
> for each(var n in tree..node) {
> with(n) {
> if(@level == 1) {
> nodesWithForEach[i++] = n;
> }
> }
> }
> out.println(nodesWithForEach.toXMLString());
> /*output:
>
>
>
>
> */
>
> Thanks,
>
> McKinley
.