Giacomo Pati wrote:


Sylvain Wallez wrote:

<snip/>

Giacomo, I started merging this with DOMFactory but cannot understand how this works. Can you explain?

AFAIK, JXPath calls the factory if the node at path "name" doesn't exist. So my understanding is that context.getValue(name) will *always* return null.


My debugging sessions showed that context.getValue(name) returs the "node"
JXPath wanted to insert something. So in my debugging session it was (because
I have bound to a Bean) the Collection holding the multi value items.


I saw you just added a test for this condition, but doesn't it have the effect of always failing by immediately returning false?


I've never had any NPEs during my tests and Marco was right that there
is a potential NPE if context.getValue(name) returns a null value. Thus the
test.


Also, what is the effect of ((Collection)context.getValue(name)).add(null)? How does adding a null value allow JXPath to continue further evaluation of the path?


JXPath will replace the null value with the value from the multi value item
it wanted to store but had to call the factory first to create the slot.


Ok. I still don't really understand (would have just as you to follow this with a debugger!), but I merged the collection and DOM factories.

Works for me using DOM (the sample is no more broken). Can you cross-check with collections so that we can declare the showstopper solved?

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director



Reply via email to