Xquery update extensions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Xquery update extensions

Marco Lebel-2
Hello all,

Context:  I am trying to insert an xml piece in a large document to do
so I have the following Xquery request:

let $doc := document("/path-to-document/account.xml")
return
update insert <user>
<username>user</username>
<password>password</password>
</user> into $doc//users


This request works in the exist sandbox and with curl.

Problem:  I am trying to achieve this request with a pipeline.  My
pipeline looks like

<?xml version="1.0" encoding="UTF-8"?>
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors"
          xmlns:xforms="http://www.w3.org/2002/xforms"
          xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <p:param name="directives" type="input"/>
   <p:param name="instance" type="input"/>
   <p:param name="response" type="output"/>
   <p:choose href="#directives">
      <p:when test="//operation='create'">
         <!--Create REST submission-->
         <p:processor name="oxf:xslt">
            <p:input name="config">
               <xforms:submission xsl:version="2.0" method="post"
                                 
action="http://localhost:8080/exist/rest/db/path-to-document/account.xml"
                                  xxforms:username="vlcUser"
xxforms:password="mbmsolution"
                                 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
            </p:input>
            <p:input name="data" href="#instance"/>
            <p:output name="data" id="submission"/>
         </p:processor>
         <!--Create xquery request-->
         <p:processor name="oxf:xslt">
            <p:input name="config">
               <exist:query xsl:version="2.0"
xmlns:exist="http://exist.sourceforge.net/NS/exist" xmlns="">
                  <exist:text>
let $doc := document(".")
return
update insert
<user><username>username</username><password>password</password></user>
into $doc//users
                  </exist:text>
               </exist:query>
            </p:input>
            <p:input name="data" href="#instance"/>
            <p:output name="data" id="cXquery"/>
         </p:processor>
         <!--Execute REST submission-->
         <p:processor name="oxf:xforms-submission">
            <p:input name="submission" href="#submission"/>
            <p:input name="request" href="#cXquery"/>
            <p:output name="response" id="result"/>
         </p:processor>
      </p:when>


Whenever I try to do the update I get a SAX error saying it is not
allowed in the prolog.... I have searched left and right but I am
clearly in the dark

Any advices?

Marco


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws