Hi Peter,
To get namespaces to bind in 2.1.8 i found you need to set
namespace-prefixes to true for the xml-parser in your cocoon.xconf
file. 2.1.8 also has some bugs in the repeater binding which prevents
the propagation of namespaces in the binding file.
See : http://issues.apache.org/jira/browse/COCOON-1671
Regards,
Suzan Foster.
--
On Mar 6, 2006, at 5:55 PM, Peter Klotz wrote:
Hi,
we are using Cocoon 2.1.8 and have a form for creating a new object.
That means there is no data loaded into the form but only saved from
the
form to a XML document.
The binding using a binding file uses XML namespaces, which seems to be
the only difference to some of the samples, where one (dynamic
repeater)
also creates a new document and then only saves the form.
The problem that we get is
Caused by: org.apache.commons.jxpath.JXPathException: Exception trying
to create xpath /ovo:policy; Cannot map non-null prefix when creating a
document element
at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPath(JXPa
thContextReferenceImpl.java:450)
at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPath(JXPa
thContextReferenceImpl.java:427)
at
org.apache.cocoon.forms.binding.ContextJXPathBinding.doSave(ContextJXPa
thBinding.java:101)
at
org.apache.cocoon.forms.binding.JXPathBindingBase.saveFormToModel(JXPat
hBindingBase.java:250)
at
org.apache.cocoon.forms.binding.JXPathBindingBase.saveFormToModel(JXPat
hBindingBase.java:264)
at sun.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:
230)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
at
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(
ContinuationInterpreter.java:1134)
at
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(
ContinuationInterpreter.java:190)
at
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(
ContinuationInterpreter.java:138)
at
org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(Inter
pretedFunctionImpl.java:121)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
at
org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.jav
a:1591)
at
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpre
ter.handleContinuation(FOM_JavaScriptInterpreter.java:853)
... 61 more
Also the method of previously loading a existing empty or full XML
document and trying to save to this does not work with even worse
exceptions.
I can't but assume that the reason is namespaces because the sample
does
exactly the same as we do and does work.
flow script function:
---
function newPolicy()
{
var definitionURI = cocoon.parameters["newDefinitionURI"];
var bindingURI = cocoon.parameters["newBindingURI"];
var form = new Form(definitionURI);
form.createBinding(bindingURI);
form.showForm("newPolicy-display");
var policy =
Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
var policy = factory.newDocumentBuilder().newDocument();
//policy.appendChild(policy.createElementNS("http://blue-elephant-
systems.com/midas/ovo/1.0",
"ovo:policy"));
// var policy = loadDocument("logfile.xml");
// get the basic policy from the form
form.save(policy);
// just for debugging
saveDocument(policy, "output.xml");
// go into edit phase
form = getPolicyForm(policy);
cocoon.request.setAttribute("formMode", "edit");
form.showForm("editPolicy-display");
form.save(policy);
saveDocument(policy, "output.xml");
}
---
sample simple binding
---
<?xml version="1.0"?>
<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
xmlns:ovo="http://blue-elephant-systems.com/midas/ovo/1.0"
path="/ovo:policy">
<fb:value id="type" path="@type"/>
<fb:value id="name" path="@name"/>
</fb:context>
---
any idea what one could do to get this to work?
Thanks, Peter
<peter.klotz.vcf>------------------------------------------------------
---------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]