Marco Rolappe wrote:

these multi value problems seem to stem from the following code (which is not present in 2.1.6) in MultiValueJXPathBinding.doSave:

...
multiValueContext.setFactory( new AbstractFactory() {
public boolean createObject(JXPathContext context, Pointer pointer,
Object parent, String name, int index) {
final Object o = context.getValue(name);
if( Collection.class.isAssignableFrom( o.getClass() ) ) {
((Collection)context.getValue(name)).add(null);
} else if( o.getClass().isArray() ) {
// not yet supported
return false;
} else {
return false;
}
return true;
}
});
...


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. I saw you just added a test for this condition, but doesn't it have the effect of always failing by immediately returning false?

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?

Sylvain

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



Reply via email to