Xforms save to file...

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

Xforms save to file...

stefan.van.de.kaa
hello,

I'm totaly not getting something... I looked at the examples but taking an example. The xforms-controls. If I fill in the form. and the I see the instance on the bottom. I should be able to save this instance too a file if i'm correct.

For I found out I should use the p:processor. Thats all i found out. If i add a submission (submit button) how am i able to really send it to a file. I think it is best still talking about the example.

Hope someone can help me out it's freeking me out.

Thanks Stefan.



--
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: Xforms save to file...

Erik Bruchez
Administrator
[hidden email] wrote:
 > hello,
 >
 > I'm totaly not getting something... I looked at the examples but
 > taking an example. The xforms-controls. If I fill in the form. and
 > the I see the instance on the bottom. I should be able to save this
 > instance too a file if i'm correct.
 >
 > For I found out I should use the p:processor. Thats all i found
 > out. If i add a submission (submit button) how am i able to really
 > send it to a file. I think it is best still talking about the
 > example.
 >
 > Hope someone can help me out it's freeking me out.

Stefan,

First, don't panic! XForms and OPS do require a certain learning
curve. There are patterns you need to get used to. Also, once we
update the OPS Tutorial to reflect the changes in OPS 3.0, things
should be easier to understand.

If I understand correctly you would like to modify the XForms Controls
example and add a functionality allowing you to save the resulting
instance to a file.

First, a quick comment. The XForms submission element is allowed to
support the "file:" URI scheme (along with the "http:", "https:" and
"mailto:" schemes). However, this is not supported in OPS at the
moment. The idea is that you could this way submit an XForms instance
directly to a file. However, due to the fact that the OPS XForms
engine is server-side, this would likely not make much sense: the file
would have to be stored on the server, and not on the client as you
could expect. At any rate, this is not mandated by the XForms spec and
is likely to be implemented differently by different XForms engines.

Now, back to your actual question. What you want to do is the
following:

1. Submit your XForms instance to a specific URL on the server. This
    is really the usual way of submitting an XForms instance, and many
    examples in OPS do this:

    <xforms:submission ref="instance('my-instance')" id="my-submission"
      method="post" action="/xforms-controls/save" replace="none"/>

    The above code will submit the specified XForms intance to the path
    "/xforms-controls/save" on the server.

2. Submitting an XForms instance is just half of the equation. Some
    code on the server must then be able to receive the submitted
    instance and do something with it. For example, the BizDoc NG
    application saves the instance into an XML database. How do you
    implement such code? Simply with a <page> entry in your page
    flow. For example:

    <page path-info="/xforms-controls/save"/>
      <action action="save-instance-action.xpl"/>
    </page>

    What the above does is respond to the XForms submission under the
    path "/xforms-controls/save" by calling the
    save-instance-action.xpl pipeline.

3. From there, you must write an XML pipeline (under
    save-instance-action.xpl) that makes sense, for example:

    <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:oxf="http://www.orbeon.com/oxf/processors">

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

        <p:processor name="oxf:xml-converter">
            <p:input name="config">
                <config>
                    <encoding>utf-8</encoding>
                </config>
            </p:input>
            <p:input name="data" href="#instance"/>
            <p:output name="data" id="converted"/>
        </p:processor>

        <p:processor name="oxf:file-serializer">
            <p:input name="config">
                <config>
                    <content-type>text/xml</content-type>
                    <directory>c:/temp</directory>
                    <file>test.xml</file>
                </config>
            </p:input>
            <p:input name="data" href="#converted"/>
        </p:processor>

    </p:config>

    Note that the result of the XML submission, i.e. in this case the
    XForms intance submitted by the XForms engine, is automatically
    made available by the PFC as the "instance" input of the pipeline.

-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
Reply | Threaded
Open this post in threaded view
|

Re: Xforms save to file...

Alessandro Vernet
Administrator
Hi Tima,

On 8/2/07, Tima <[hidden email]> wrote:
> I used this code to save my XML files.(thanks Erik), but now I m trying to
> do the same with a browse [input type="file"] so if any one can help me
> please! I've tried some solution but it doesn't work the problem is how to
> send the file path and the instance together to the xpl ?

So you would like to have a first XForms page where you can upload an
XML file, and this XML file is then used as an instance in a second
XForms page. Is this correct?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
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