Database Reference
In-Depth Information
We specify the collection /db/registration as the first argument to xmldb:store ,
which is the collection in which to store the document.
Note that the second argument to xmldb:store is the empty sequence ; this tells
eXist that we do not know the name of the document we wish to store. eXist will
create a name for the document on our behalf; a random-number generator is
used and the result is encoded into a hexadecimal string for use as the filename.
The function request:get-data will retrieve the body of an incoming HTTP
POST or PUT request; in this case, it will be the instance content from the XForm.
We return to the XForm submission a simple XML document, which, although
we do not act on it in our form here, could be used for instructing the XForm
further.
An XForms submission declaration to submit the instance to this XQuery would then
look like:
<xf:submission id= "s-save" method= "post"
resource= "http://localhost:8080/exist/rest/db/registration.xq"
replace= "none" >
<xf:action ev:event= "xforms-submit-error" >
<xf:message>
Registration failed. Please fill in valid values
</xf:message>
</xf:action>
<xf:action ev:event= "xforms-submit-done" >
<xf:message> You have been registered successfully. </xf:message>
</xf:action>
</xf:submission>
Search WWH ::




Custom Search