cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hepabolu <hepab...@gmail.com>
Subject Re: CForms binding with namespaces error - advice wanted
Date Wed, 23 May 2007 19:28:21 GMT
Joerg Heinicke said the following on 23/5/07 20:03:
> On 23.05.2007 13:07, hepabolu wrote:
> 
>>> + I would comment  (or even close-wontfix?) that bug with a reference 
>>> to the above conclusion from carsten.  Just in case somebody would 
>>> want to apply the patch without giving it more thought...
>>
>> I just added a comment.
> 
> Using the param is an appropriate solution and the patch is no longer 
> valid. Since the issue (COCOON-1686) was especially created as patch to 
> COCOON-1671 I closed it, but added a comment and link from COCOON-1671 
> to it.

Thanks. Sadly enough it still doesn't solve my problem.

I hope some of you can shed some light on this:

In flowscript I create the various cform files through pipelines (see [1]).
When I read the source from a file by using the line marked with 
[****X****] instead of the one below, the binding starts to work (I get 
an error on expected BigDecimal vs received String, but that's a 
different problem). This source file is created by displaying the output 
of the pipeline of the line below in a browser and saving the source of 
that output in a file.

When I use the code as is below (i.e. the source is read from a 
pipeline) the binding silently fails with a debug message in the log files:
PoolThread-4/ContextJXPathBinding: non-existent path: skipping 
ContextJXPathBinding [xpath=/oe:version]

(oe:version is the root element).

Both binding and source file have the namespace set:

<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" 
xmlns:oe="openEHR/v1/Version" path="/oe:version">

and

<oe:version xmlns:oe="openEHR/v1/Version">

Anyone?

Thanks.

Bye, Helma


[1]
showmyform() {
     var formFileName = cocoon.parameters["filename"];

     /* Generate the template from a pipeline */
     var formDisplay = "FormTemplatePipeline/" + formFileName;

     /* Generate the model from a pipeline */
     var pipelineUtil = 
cocoon.createObject("org.apache.cocoon.components.flow.util.PipelineUtil");
     var modelDoc = pipelineUtil.processToDOM("FormModelPipeline/"+ 
formFileName, {}).getDocumentElement();

     /* Generate the binding from a pipeline */
     var bindingDoc = pipelineUtil.processToDOM("FormBindingPipeline/" + 
formFileName, {}).getDocumentElement();
     //var bindingDoc = FORMDIR + "test-bloodfilmBinding.xml";

     var form = new Form(modelDoc);
     form.createBinding(bindingDoc);

     /* Generate the result file */
     var formResult = formFileName + "Result.jx";

     // get the documentURI parameter from the sitemap which contains the
     // location of the file to be edited
     var documentURI = cocoon.parameters["documentURI"];

     // parse the document to a DOM-tree
     //[****X****]var document = _loadDocument(documentURI);
     var document = pipelineUtil.processToDOM("AddIDsPipeline/" + 
formFileName, {});

     // bind the document data to the form
     form.load(document.getDocumentElement());

     // show the form to the user until it is validated successfully
     form.showForm(formDisplay);

     // bind the form's data back to the document
     form.save(document);

     cocoon.sendPage(formResult);
}

_loaddocument(uri){
.....
         parser = 
cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
         resolver = 
cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
         source = resolver.resolveURI(uri);
         print ("sourceURI=" + source.getURI());
         var is = new 
Packages.org.xml.sax.InputSource(source.getInputStream());
         is.setSystemId(source.getURI());
         return parser.parseDocument(is);
......
}


Mime
View raw message