You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@s-und-n.de> on 2004/09/02 11:40:17 UTC

[CForms] Binding and Namespaces

If I'm binding an XML document to a form, is it possible
to use namespaces in the binding? (The bound data has
namespaces)

Thanks
Carsten 



Re: [CForms] Binding and Namespaces

Posted by Marc Portier <mp...@outerthought.org>.

Gianugo Rabellino wrote:
> On Sep 2, 2004, at 5:43 PM, Marc Portier wrote:
> 
>> Sylvain Wallez wrote:
>>
>>> Marc Portier wrote:
>>>
>>>>
>>>>
>>>> Sylvain Wallez wrote:
>>>>
>>>>> Carsten Ziegeler wrote:
>>>>>
>>>>>> If I'm binding an XML document to a form, is it possible to use 
>>>>>> namespaces in the binding? (The bound data has namespaces)
> 
> 
> After a very long hiatus (didn't know what swamped really meant until 
> the last three months) I finally found the time to integrate into the 
> current codebase the work Marc (mainly) and I did at the Gettogether. 
> The changes I have on my hard disk (only on BRANCH_2.1.X, but they 
> should work on trunk as well) support an almost complete support for 
> namespaced XML binding. However, I'm a bit uncomfortable in committing 
> it right away since they touch an area where I have limited knowledge of 
> possible side effects. Would you rather have me commit the whole thing 
> right away or rather submit a patch in Bugzilla?
> 

+1 for putting it in right away

as I remember things were pretty stable already and I suspect since then 
you have had some practical usage already that should've straightened 
everything out, no?

any other issues coming up we'll have to take up from there (which is 
also easier if it's not just a patch applied here and there but a 
widespread new feature to be used)

-marc=
-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org

Re: [CForms] Binding and Namespaces

Posted by Gianugo Rabellino <gi...@apache.org>.
On Sep 2, 2004, at 5:43 PM, Marc Portier wrote:
> Sylvain Wallez wrote:
>
>> Marc Portier wrote:
>>>
>>>
>>> Sylvain Wallez wrote:
>>>
>>>> Carsten Ziegeler wrote:
>>>>
>>>>> If I'm binding an XML document to a form, is it possible to use 
>>>>> namespaces in the binding? (The bound data has namespaces)

After a very long hiatus (didn't know what swamped really meant until 
the last three months) I finally found the time to integrate into the 
current codebase the work Marc (mainly) and I did at the Gettogether. 
The changes I have on my hard disk (only on BRANCH_2.1.X, but they 
should work on trunk as well) support an almost complete support for 
namespaced XML binding. However, I'm a bit uncomfortable in committing 
it right away since they touch an area where I have limited knowledge 
of possible side effects. Would you rather have me commit the whole 
thing right away or rather submit a patch in Bugzilla?

Ciao,
-- 
Gianugo Rabellino
Pro-netics s.r.l. -  http://www.pro-netics.com
Orixo, the XML business alliance: http://www.orixo.com


Re: [CForms] Binding and Namespaces

Posted by Marc Portier <mp...@outerthought.org>.

Sylvain Wallez wrote:

> Marc Portier wrote:
> 
>>
>>
>> Sylvain Wallez wrote:
>>
>>> Carsten Ziegeler wrote:
>>>
>>>> If I'm binding an XML document to a form, is it possible to use 
>>>> namespaces in the binding? (The bound data has namespaces)
>>>
>>>
>>>
>>> The solution I've used successfully up to now is to bind to a 
>>> document that already has a root element which holds the namespace 
>>> definitions with the same prefixes as those used in the binding. This 
>>> works thanks to o.a.c.util.jxpath.DOMFactory.
>>
>>
>>
>> good remark: this one should be in sync!
> 
> 
> 
> Sorry, in sync with what?
> 

with true namespace-support?
meaning the 'same-prefix' limitation could then be removed maybe

>>> Now, as mentioned, the recent JXPath 1.2 has added real support for 
>>> namespaces, which may allow us to use the namespaces used in the 
>>> binding file without the previous trick.
>>
>>
>>
>> didn't know about the new release, I would propose to allow
>>
>> namespace-definitions on the level of the jxpathbindingbase then, it 
>> should glob all xmlns: stuff that was on his corresponding definition 
>> element, and then
>> - set those to the jxpath context
>> - execute actual binding (possibly delegates to children)
> 
> 
> 
> Exactly.
> 
>> - (is it possible?) remove them again (as other siblings might have 
>> used same prefixes to other ns-uri's?)
> 
> 
> 
> Why so? Each binding will have its own set of namespaces (built by 
> analyzing the ancestor tree), meaning there is no overlap between siblings.
> 

good remark, in my head I wasn't looking in the ancestor tree, since it 
would get applied implicitely by adding them to the context as we got 
down the structure (but then need to be able to remove again)

it kinda depends on
- 'is remove possible' and
- 'isn't setting it continuously on every node going to slow things down?'

>> like that every wb:* could allow to have local xmlns stuff declared...
> 
> 

regards,
-marc=
-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org

Re: [CForms] Binding and Namespaces

Posted by Sylvain Wallez <sy...@apache.org>.
Marc Portier wrote:

>
>
> Sylvain Wallez wrote:
>
>> Carsten Ziegeler wrote:
>>
>>> If I'm binding an XML document to a form, is it possible to use 
>>> namespaces in the binding? (The bound data has namespaces)
>>
>>
>> The solution I've used successfully up to now is to bind to a 
>> document that already has a root element which holds the namespace 
>> definitions with the same prefixes as those used in the binding. This 
>> works thanks to o.a.c.util.jxpath.DOMFactory.
>
>
> good remark: this one should be in sync!


Sorry, in sync with what?

>> Now, as mentioned, the recent JXPath 1.2 has added real support for 
>> namespaces, which may allow us to use the namespaces used in the 
>> binding file without the previous trick.
>
>
> didn't know about the new release, I would propose to allow
>
> namespace-definitions on the level of the jxpathbindingbase then, it 
> should glob all xmlns: stuff that was on his corresponding definition 
> element, and then
> - set those to the jxpath context
> - execute actual binding (possibly delegates to children)


Exactly.

> - (is it possible?) remove them again (as other siblings might have 
> used same prefixes to other ns-uri's?)


Why so? Each binding will have its own set of namespaces (built by 
analyzing the ancestor tree), meaning there is no overlap between siblings.

> like that every wb:* could allow to have local xmlns stuff declared...


Yup.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: [CForms] Binding and Namespaces

Posted by Marc Portier <mp...@outerthought.org>.

Sylvain Wallez wrote:

> Carsten Ziegeler wrote:
> 
>> If I'm binding an XML document to a form, is it possible
>> to use namespaces in the binding? (The bound data has
>> namespaces)
>>  
>>
> 
> The solution I've used successfully up to now is to bind to a document 
> that already has a root element which holds the namespace definitions 
> with the same prefixes as those used in the binding. This works thanks 
> to o.a.c.util.jxpath.DOMFactory.
> 

good remark: this one should be in sync!

> Now, as mentioned, the recent JXPath 1.2 has added real support for 
> namespaces, which may allow us to use the namespaces used in the binding 
> file without the previous trick.
> 

didn't know about the new release, I would propose to allow

namespace-definitions on the level of the jxpathbindingbase then, it 
should glob all xmlns: stuff that was on his corresponding definition 
element, and then
- set those to the jxpath context
- execute actual binding (possibly delegates to children)
- (is it possible?) remove them again (as other siblings might have used 
same prefixes to other ns-uri's?)

like that every wb:* could allow to have local xmlns stuff declared...

wdyt?
-marc=


> Sylvain
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org

Re: [CForms] Binding and Namespaces

Posted by Sylvain Wallez <sy...@apache.org>.
Carsten Ziegeler wrote:

>If I'm binding an XML document to a form, is it possible
>to use namespaces in the binding? (The bound data has
>namespaces)
>  
>

The solution I've used successfully up to now is to bind to a document 
that already has a root element which holds the namespace definitions 
with the same prefixes as those used in the binding. This works thanks 
to o.a.c.util.jxpath.DOMFactory.

Now, as mentioned, the recent JXPath 1.2 has added real support for 
namespaces, which may allow us to use the namespaces used in the binding 
file without the previous trick.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: [CForms] Binding and Namespaces

Posted by Bruno Dumon <br...@outerthought.org>.
On Thu, 2004-09-02 at 11:55, Marc Portier wrote:
> Carsten Ziegeler wrote:
> 
> > If I'm binding an XML document to a form, is it possible
> > to use namespaces in the binding? (The bound data has
> > namespaces)
> > 
> 
> not yet, no
> it's a long outstanding todo :-(
> 
> basically, it boils down to understanding if and how jxpath can do it.

I thought the new JXPath release does support namespaces, so it might
now be possible to do something about it.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


RE: [CForms] Binding and Namespaces

Posted by Carsten Ziegeler <cz...@apache.org>.
Marc Portier wrote:
> 
> Carsten Ziegeler wrote:
> 
> > If I'm binding an XML document to a form, is it possible to use 
> > namespaces in the binding? (The bound data has
> > namespaces)
> > 
> 
> not yet, no
> it's a long outstanding todo :-(
> 
Ah, ok.

> basically, it boils down to understanding if and how jxpath can do it.
> 
As far as I understand it, you need to register the namespaces on the
JXPathContext:
http://jakarta.apache.org/commons/jxpath/users-guide.html#Registering%20Name
spaces

So, we would have to register all namespaces used in the binding document.
Sounds not too difficult, or do I oversee something?

Carsten


Re: [CForms] Binding and Namespaces

Posted by Marc Portier <mp...@outerthought.org>.

Carsten Ziegeler wrote:

> If I'm binding an XML document to a form, is it possible
> to use namespaces in the binding? (The bound data has
> namespaces)
> 

not yet, no
it's a long outstanding todo :-(

basically, it boils down to understanding if and how jxpath can do it.

-marc=
-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org