cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Woody binding to incomplete XML documents
Date Sun, 07 Sep 2003 21:59:17 GMT
Hi,

I'm using Woody to modify data in an XML document and encountered a lot 
of binding problems because the document is initially incomplete (not 
all elements are present).

1/ Loading a form fails with a freshly created document because some 
elements don't exist. A solution to this is to make the JXPathContext 
lenient (IIRC, Marc proposed it some time ago) so that binding doesn't 
fail if a path doesn't exist.

2/ The same reasons (non-existent elements) lead the saving to fail. The 
solution is to use createPathAndSetValue() instead of just setValue(). 
In the general case, this will also fail unless a JXPath AbstractFactory 
is provided to the JXPathContext. I wrote one for DOM elements.

3/ When a field value is null, I would like the corresponding path to be 
deleted rather than setting its value to null. This will remove elements 
rather than emptying them. Should this be configurable (i.e. 
delete-on-null="true") ? Note that this only impacts DOM bindings since 
deleting on JavaBeans is exactly the same as setting the value to null 
(the property cannot be removed from the class!).

How does this sound ?

Ah, and some additional goodies I wrote (need a bit testing before 
committing) :
- a simple binding for repeaters that deletes all values before 
re-adding them. This avoids the need for unique row-ids as required by 
the current repeater binding.
- a stylesheet to generate the binding from <wd:binding> elements and 
wb:* attributes in the form definition. Very convenient, as it avoids 
the need for a separate binding file.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Mime
View raw message