cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Héléna Tanguy <htan...@jouve.fr>
Subject Re: Binding on different xml paths
Date Tue, 05 Aug 2008 08:12:43 GMT
My problem was to bind a form on 2 different xml paths (so 2 bindings), 
I have resolved it by rewriting binding functions like this :

function createAndGetBinding(bindingURI) {
    var bindingManager = null;
    var source = null;
    var resolver = null;

    try {
        bindingManager = 
cocoon.getComponent(Packages.org.apache.cocoon.forms.binding.BindingManager.ROLE);
        resolver = 
cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
        source = resolver.resolveURI(bindingURI);
        return bindingManager.createBinding(source);
    } finally {
        if (source != null)
            resolver.release(source);
        cocoon.releaseComponent(bindingManager);
        cocoon.releaseComponent(resolver);
    }
}

Then I use this function to create 2 bindings, and I use twice the 
function loadFormFromModel to load data to my form with the 2 bindings.
I found this solution on a old post about woody, but that already works 
on cocoon forms.



Barbara Slupik a écrit :
> Can you please explain it once again? I don't really understand your 
> problem.
>
> Barbara
>
> On 28 Jul, 2008, at 6:00 pm, Héléna Tanguy wrote:
>
>> Hello,
>>
>> I'm working on a cocoon form with binding on xml document. Now 
>> everything works correctly.
>> But I must make an evolution to this form, the binding must be made 
>> on 2 xml different paths.
>>
>> For example:
>> Some widgets are binded with this xml path: 
>> myData/contacts/contact[position="x"]/name, etc
>> Some other widget must be binded with this other xml path: 
>> myData/customers/customer[position="x"]/customerId, etc.
>> I must display in my form the contact name and the customer id. The 
>> contact in position 1 is the same person than the customer in 
>> position 1, etc.
>> I precise that the xml format cannot be modified, it is a standard 
>> format.
>>
>> In the existing form, the binding was made with 
>> "myData/contacts/contact[position="x"]", but it is not possible to 
>> bind the other widget with this xml path.
>>
>> So my question is: how to do the binding with these 2 xml paths ? Is 
>> it possible to pass a parameter in the binding file to precise the 
>> position for the person ?
>>
>> Thank you
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


-- 
JOUVE <http://www.jouve.fr/> 	

Héléna Tanguy
Ingénieur logiciel / Software engineer
Propriété industrielle / Industrial Property
htanguy@jouve.fr <mailto:htanguy@jouve.fr>

12, rue des Landelles - Immeuble Hercule 2 - 35510 Cesson Sévigné - France
Tél. : + 33 (0) 2 99 86 07 52 - Fax : + 33 (0) 2 99 86 98 01


          Le présent mail ainsi que toutes les informations qu'il
          contient ne peuvent en aucun être considérés comme un
          engagement juridique de quelque nature que ce soit de JOUVE.
          Tout accord devra être formulé par écrit papier ultérieur
          signé par un représentant légal de JOUVE. Par ailleurs, si
          vous recevez ce mail par erreur, merci de nous le signaler et
          de le détruire ainsi que l'intégralité du document qui
          pourrait y être joint.


Mime
View raw message