Sylvain Wallez wrote:
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.

I've skimmed the JXPath samples, guessed how it could work and used the debugger to verify until it was working (actually I've missed the existence of the BindingJXPathFactory class).


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?

Yup, works for me.

Giacomo

--
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Reply via email to