En/na Thorsten Scherler ha escrit:
Answering my own question:

On Thu, 2005-09-01 at 13:47 +0200, Thorsten Scherler wrote:
  
Hi all,

I have a problem with the binding to elements that have a namespace
declared.

I am using the dynamicrepeater example. 
I saved the outcome of the example to a file
form.save(doc);
saveDocument(doc, "PATH_TO_SAVE_THE_FILE").

I then changed the example code a wee bit further by adding 
form.load("URI_TO_DATA"); 
before the 
form.showForm("DYNAMICREPEATER");

I have now the form showing up with the values I used before (like I
suspected).

When I change in the input file ("URI_TO_DATA"):
<contracts xmlns="http://testing.com/">
...
</contracts>
then I do not see the preselection and cannot save the form anymore.

    

If you do not use the standard namespace (xmlns="http://testing.com/")
but  xmlns:contracts="http://testing.com/" then it is working again.

Is this a bug that I cannot use the standard namespace?

salu2
  
When you use a default namespace all elements without explicit namespace are in the default namespace.
This document:
[doc1]
<contacts xmlns="http://testing.com/">
...
</contacts>

is equals to:
[doc2]
<contacts:contacts xmlns:contacts="http://testing.com/" >
...
</contacts:contacts>

not to:
[doc3]
<contacts xmlns:contacts="http://testing.com/" >
...
</contacts:contacts>

In the [doc3] the contacts element has not namespace while in the [doc1] and [doc2] documents  the contacts element is in the "http://testing.com/"
In the binding document you must match contacts:contacts and not just contacts if you use a default namespace. The binding document must be:
<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
	    xmlns:contacts="http://testing.com/"
    path=".">
    
  <fb:simple-repeater id="contacts" parent-path="contacts:contacts" row-path="contacts:contact">
    <fb:value id="ID" path="@id"/>
    <fb:value id="firstname" path="contacts:firstname"/>
    <fb:value id="lastname" path="contacts:lastname"/>
  </fb:simple-repeater>
</fb:context>

I think this must work, but I don't test it. Today I see tree pages [1][2][3] about the problems with default namespaces, maybe the binding xpath have this problems too:

[1]http://www.anyware-tech.com/blogs/sylvain/archives/000213.html
[2]http://www.xml.com/pub/a/2004/02/25/qanda.html
[3]http://weblogs.mozillazine.org/weirdal/archives/008806.html
--
Josep A. Frau
Centre de Tecnologies de la Informació
Universitat de les Illes Balears

Reply via email to