commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject Re: [JXPath] Pointers Iterator Returning Wrong Number Results
Date Mon, 19 May 2003 21:45:29 GMT
Julian,

Most likely the simultaneous modification is what is causing the
observed behavior.  You might want to find all children you intend to
delete first, and then actually delete them one by one starting with
the last.

Anyway, in order to provide more concrete answer, I will need more
information.  Please describe the data you are applying the XPath to.

Thanks,

- Dmitri


--- Julian <cerebro70@yahoo.com> wrote:
> Hi All,
> 
> I am trying to use JXPath for the first time and when
> I try to iterate over pointers for a given context, I
> only get one of the two child objects expected. I have
> tried various xpath expressions to retrieve the
> children, but to no avail (e.g. /*,*, and child::*). 
> Once I retrieve them I want to delete them, but again
> only one is deleted from the Document. I must add that
> I am doing this to test the capabilities of JXPath...I
> will prob want to conduct more complicated xpaths and
> iterations.  Could someone help me with this problem? 
> 
> 
> Thanks A Lot,
> Julian
> 
> <snippet>
>             JXPathContext context =
> JXPathContext.newContext(genNode);//node with children
> in question
>             Iterator genValues =
> context.iteratePointers("*");//get all node's children
> 
>                 while(genValues.hasNext()) {
>                     
>                     NodePointer nodePointer =
> (NodePointer)genValues.next();
>                    
>                       Node testNode =
> (Node)nodePointer.getNode();//get Node from pointer
>                      
> genNode.removeChild(testNode);//remove node in
> question 
>                 }
> </snippet>
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Mime
View raw message