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(JXPathContextReferenceImpl.java:450)
        at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPath(JXPathContextReferenceImpl.java:427)
        at
org.apache.cocoon.forms.binding.ContextJXPathBinding.doSave(ContextJXPathBinding.java:101)
        at
org.apache.cocoon.forms.binding.JXPathBindingBase.saveFormToModel(JXPathBindingBase.java:250)
        at
org.apache.cocoon.forms.binding.JXPathBindingBase.saveFormToModel(JXPathBindingBase.java:264)
        at sun.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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(InterpretedFunctionImpl.java:121)
        at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
        at
org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1591)
        at
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.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
begin:vcard
fn:Peter Klotz
n:Klotz;Peter
org:blue elephant systems GmbH
adr:;;Wollgrasweg 49;Stuttgart;;70599;Germany
email;internet:[EMAIL PROTECTED]
title:Chief Architect
tel;work:+49 711 451017-570
tel;fax:+49 711 451017-573
tel;cell:+49 170 9380410
x-mozilla-html:FALSE
url:http://www.blue-elephant-systems.com
version:2.1
end:vcard


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to