Updating instance data in XPL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating instance data in XPL

Boon Low
Hi,

I would like to find out more about how the following use case  
described in the OPS documentations works:

"View and Model with XML Submission, Case 2"
http://www.orbeon.com/ops/doc/reference-page-flow#d161927e2245

I am working on a XForms-based editor that needs to:

Step 1: take an ID (part of instance data) input via URL (http://url?
id=xxxx)
Step 2: retrieve form content (identified by ID) from a database via  
another URL (REST)
Step 3: populate the form with the content (rest of instance data)  
and get it ready for editing.

This seems to correspond with the use case stated in the documentation.

I have done steps 1 and 2 using the following page flow and default  
submission:

<page path-info="/editor" model="load-data.xpl"
     default-submission="formModel.xml"  view="editor.xsl" >
         <setvalue ref="/instance/id" parameter="id"/>
</page>

with the following element in the form view:

<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
     <xforms:instance>
             <xsl:copy-of select="doc('input:instance')"/>
      </xforms:instance>
     ......
</xforms:model>

and a "prologue" load-data.xpl to retrieve the form content from a  
database. But I am stuck at Step 3.

Question - how do you:
1. update the instance data in XPL, and
2. output the instance data back to the form view?

I thought passing instance data is implicit.. in that as long as it  
is updated in the XPL, you can use doc('input:instance') to access  
it. But this seems not to be case as described in the OPS  
documentation: "...the model declares an instance output. This allows  
the model to modify the submitted XML instance..." .



Boon



-----
Boon Low
System Developer, EGEE Training
UK National e-Science Centre
http://homepages.ed.ac.uk/boon





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Updating instance data in XPL

Boon Low
Hi,

Solved this by using the following parameters at the beginning of the  
XPL.

     <p:param name="instance" type="input"/>
     <p:param name="instance" type="output"/>

and used a XUpdate processor with the following output.

     <p:output name="data" ref="instance"/>

Hope this is may be useful to you..

Side question: is there any processor in OPS for encoding XML (say  
from a XSLT processor) as Base64 binary? I need to send the data to a  
SOAP-based web service which accepts base64Binary in one of the  
parameter (the rest are strings) . Does the delegation processor  
allow any encoding at all? As far as I can gauge from the  
documentation, OPS only deals with decoding binary into XML not the  
other way around..

Regards,

Boon


-----
Boon Low
System Development Officer,
EGEE Training and Induction
UK National e-Science Centre
http://homepages.ed.ac.uk/boon


On 7 Sep 2005, at 14:46, Boon Low wrote:


> Hi,
>
> I would like to find out more about how the following use case  
> described in the OPS documentations works:
>
> "View and Model with XML Submission, Case 2"
> http://www.orbeon.com/ops/doc/reference-page-flow#d161927e2245
>
> I am working on a XForms-based editor that needs to:
>
> Step 1: take an ID (part of instance data) input via URL (http://
> url?id=xxxx)
> Step 2: retrieve form content (identified by ID) from a database  
> via another URL (REST)
> Step 3: populate the form with the content (rest of instance data)  
> and get it ready for editing.
>
> This seems to correspond with the use case stated in the  
> documentation.
>
> I have done steps 1 and 2 using the following page flow and default  
> submission:
>
> <page path-info="/editor" model="load-data.xpl"
>     default-submission="formModel.xml"  view="editor.xsl" >
>         <setvalue ref="/instance/id" parameter="id"/>
> </page>
>
> with the following element in the form view:
>
> <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
>     <xforms:instance>
>             <xsl:copy-of select="doc('input:instance')"/>
>      </xforms:instance>
>     ......
> </xforms:model>
>
> and a "prologue" load-data.xpl to retrieve the form content from a  
> database. But I am stuck at Step 3.
>
> Question - how do you:
> 1. update the instance data in XPL, and
> 2. output the instance data back to the form view?
>
> I thought passing instance data is implicit.. in that as long as it  
> is updated in the XPL, you can use doc('input:instance') to access  
> it. But this seems not to be case as described in the OPS  
> documentation: "...the model declares an instance output. This  
> allows the model to modify the submitted XML instance..." .
>
>
>
> Boon
>
>
>
> -----
> Boon Low
> System Developer, EGEE Training
> UK National e-Science Centre
> http://homepages.ed.ac.uk/boon
>
>
>
>
> --
> You receive this message as a subscriber of the ops-
> [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/ 
> wws
>
>




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Updating instance data in XPL

Erik Bruchez
Administrator
Boon Low wrote:

> Hi,
>
> Solved this by using the following parameters at the beginning of the  XPL.
>
>     <p:param name="instance" type="input"/>
>     <p:param name="instance" type="output"/>
>
> and used a XUpdate processor with the following output.
>
>     <p:output name="data" ref="instance"/>
>
> Hope this is may be useful to you..
Thanks for the tip to the list. You got it, this is exactly the way to
do it. Of course you do not have to use oxf:xupdate, but you can also
use oxf:xslt, or in fact anything you want to produce the resulting XML
instance.

> Side question: is there any processor in OPS for encoding XML (say  from
> a XSLT processor) as Base64 binary? I need to send the data to a  
> SOAP-based web service which accepts base64Binary in one of the  
> parameter (the rest are strings) . Does the delegation processor  allow
> any encoding at all? As far as I can gauge from the  documentation, OPS
> only deals with decoding binary into XML not the  other way around..

That's correct. The XML converter produces a text document, and the
To-XML converter converts from Base64, not to Base64.

There is org.orbeon.oxf.util.Base64.encode(byte[] binaryData) which you
may be able to call from XSLT, but we have not tried that.

I entered an RFE for this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=304098&group_id=168&atid=350210

Not sure what the best way to go is!

-Erik



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws