Hi,
 
I'm trying to use a simple repeater in my binding with an xml document. When saving my document I get the following error:
 
Exception trying to create xpath.... Factory is not set on the JXPathContext - cannot create path: ....
 
I did a bit of sniffing and found a reply on a chain of mails that stated: (mail from  Sylvain in reply to Timothy Larson )
 
<snip>
 Actually, there's currently no use of this class in Cocoon samples, but I use it on my projects. Here's how: in the flow, I don't load/save the DOM directly, but through a JXPathContext as follows;

 var doc = readDocument(url);
 var bindingCtx = createBindingContext(doc);
 form.load(bindingCtx);
 form.showForm("pipeline");
 form.save(bindingCtx);

And here's the createBindingContext function:

function createBindingContext(document) {
// Create a JXPath context on the document.
var xpathContext = Packages.org.apache.commons.jxpath.JXPathContext.newContext(document);
// Set it to lenient
xpathContext.setLenient(true);
// Add the necessary factory create elements and attributes as needed on non-existing paths
xpathContext.setFactory(new Packages.org.apache.cocoon.util.jxpath.DOMFactory());
return xpathContext;
}
</snip>
 
But I don't get how to do the same (as stated in the previous flowscript) in Apples. Where do I create the context and how do I add it? The form stuff in Apples is somewhat different than the flowscript, and hence I get a bit lost (not many docs on Apples, so always looking through the api). I use Apples because of the more complex flow I have. (eg locking of files, checking on timestamps, selecting pipelines based on datasource attributes...) I'm hoping that I'm in the right direction with my choice of flow...(any comments on why to choose flowscript or another flow would be interesting here;-)
 
Bye,
 
Jan
 
 
 

Reply via email to