Hi Immanuel,

Perhaps you should consider using HTTP POST and creating a save.xq
similar to the one in the Beginner's Guide.  The problem with PUT is
that you must make sure that you have write access and this opens up
security concerns.  HTTP POST allows you to use the request:get-data()
to get the incoming data file and then do an xmldb:store()

Here is the submission line:

<xf:submission id="save" method="post" action="{if ($new='true') then
('save-new.xq') else ('update.xq')}" instance="my-task"
replace="all"/>

http://www.danmccreary.com/xrx/beginners-guide/beginners-guide-to-xrx.xhtml#d0e733

- Dan

On Wed, Oct 31, 2012 at 6:06 PM, Immanuel Normann
<[email protected]> wrote:
> Hi,
>
> I still try to understand how submission put and get works. Exist-db comes
> with the example
> exist/webapp/xforms/hello2.xml (I assume it is known to you?! see
> http://exist-db.org/exist/xforms/hello2.xml).
>
> This example works basically as one expects. In order to learn from it I
> made copy to
>
> /db/my-hello.xml
>
> and changed only two paths in that file to fit to my setting:
>
>   <xf:submission id="put-to-db" method="put" replace="none"
> resource="../rest/db/xforms-example-hello2.xml">
>
> to
>
>   <xf:submission id="put-to-db" method="put" replace="none"
> resource="/exist/rest/db/xforms-example-my-hello.xml">
>
> and
>
>
>    <xf:submission id="get-from-db" method="get" replace="instance"
> resource="../rest/db/xforms-example-hello2.xml?_query=/person&amp;_wrap=no">
>
> to
>     <xf:submission id="get-from-db" method="get" replace="instance"
> resource="/exist/rest/db/xforms-example-my-hello.xml?_query=/person&amp;_wrap=no">
>
> And this is my problem:
>
> Let's say the initial content of /exist/rest/db/xforms-example-my-hello.xml
> is
>
> <person>
>     <name>Otto</name>
> </person>
>
> When I go to http://localhost:8080/exist/rest/db/my-hello.xml everything is
> displayed as in the hello2 example.
>
> Now I type in the text: Anna
> and push the button: Safe
>
> This changes /exist/rest/db/xforms-example-my-hello.xml to:
>
> <person>
>   <name>Anna</name>
>   <name>Otto</name>
>   <name/>
>   <name/>
>   <test/>
>   <name/>
> </person>
>
> Actually this is the same effect as in the hello2 example. The first
> question here: why is
>
>   <name/>
>   <name/>
>   <test/>
>   <name/>
>
> added? I would expect only a change to
>
> <person>
>   <name>Anna</name>
>   <name>Otto</name>
> </person>
>
> But even more strange is the effect of the following interaction:
>
> Let's start again with
>
> <person>
>     <name>Otto</name>
> </person>
>
> Now I type again the text: Anna
> but push then the button: Refresh from DB
>
> Still the content of  xforms-example-my-hello.xml is (as expected):
>
> <person>
>     <name>Otto</name>
> </person>
>
> However, when I type again: Anna
> And then push the button: Safe
>
> Then the content of xforms-example-my-hello.xml is:
>
> <exist:result>
>   <name>Anna</name>
> </exist:result>
>
> That's not I would expect. Instead I would expect again:
>
> <person>
>   <name>Anna</name>
>   <name>Otto</name>
> </person>
>
> For me the behaviour of submission is thus rather unpredictable. Or do you
> have an explanation? I would be very happy to learn how this submission
> really works.
>
> Immanuel
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Xsltforms-support mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xsltforms-support
>



-- 
Dan McCreary
NoSQL Evangelist
office: (952) 931-9198
cell: (612) 986-1552

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to