[MarkLogic Dev General] Problem with update node
Geert Josten
Geert.Josten at daidalos.nl
Tue Oct 13 08:32:40 PDT 2009
I have used the following query now and then to analyse requests sent by submit forms. Might be of help to you:
xquery version "1.0";
declare namespace xdmp="http://marklogic.com/xdmp";
xdmp:set-response-content-type("application/xml; charset=utf-8"),
<request> 
<request-client-address>{xdmp:get-request-client-address()}</request-client-address> 
<request-method>{xdmp:get-request-method()}</request-method> 
<request-path>{xdmp:get-request-path()}</request-path> 
<request-user>{xdmp:get-request-user()}</request-user> 
<request-username>{xdmp:get-request-username()}</request-username> 
<request-header-names>{string-join(xdmp:get-request-header-names(), ", ")}</request-header-names> 
{
for $name in xdmp:get-request-header-names()
return (
' ',
<request-header name="{$name}">
{xdmp:get-request-header($name)}
</request-header>,
' '
), ' '
}
<session-field-names>{string-join(xdmp:get-session-field-names(), ", ")}</session-field-names> 
{
for $name in xdmp:get-session-field-names()
return (
' ',
<session-field name="{$name}">
{xdmp:get-session-field($name)}
</session-field>,
' '
), ' '
}
<request-field-names>{string-join(xdmp:get-request-field-names(), ", ")}</request-field-names> 
{
for $name in xdmp:get-request-field-names()
return (
' ',
<request-field
name="{$name}"
content-type="{xdmp:get-request-field-content-type($name)}"
filename="{xdmp:get-request-field-filename($name)}"
>
{
if (not(xdmp:get-request-field-filename($name))) then
xdmp:get-request-field($name)
else ()
}
</request-field>,
' '
), ' '
}
<request-body parsed-as="xml">{xdmp:get-request-body("xml")}</request-body> 
</request>, ' '
Kind regards,
Geert
> -----Original Message-----
> From: general-bounces at developer.marklogic.com
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of
> Geert Josten
> Sent: dinsdag 13 oktober 2009 17:29
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] Problem with update node
>
> Rahul,
>
> I have played around a bit with your files. I recommend you
> start with testing the form for entering the update info.
> Just pressing the submit button already makes clear only two
> out of 7 input fields are being passed along as request
> parameters. I do not see obvious flaws, apart from the fact
> that you declare an xhtml namespace, but don't use it. And
> you have non-empty br elements, which is not allowed. I only
> see calculateUri and Status return as request parameters in
> the browser url. It almost looks like the fields in between
> are not seen as part of the same form. Fix this, and your
> node-uri call will most likely no longer throw errors as well..
>
> Kind regards,
> Geert
>
> >
>
>
> Drs. G.P.H. Josten
> Consultant
>
>
> http://www.daidalos.nl/
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> Tel.: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> http://www.daidalos.nl/
> KvK 27164984
> De informatie - verzonden in of met dit emailbericht - is
> afkomstig van Daidalos BV en is uitsluitend bestemd voor de
> geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen,
> verzoeken wij u het te verwijderen. Aan dit bericht kunnen
> geen rechten worden ontleend.
>
>
> > From: general-bounces at developer.marklogic.com
> > [mailto:general-bounces at developer.marklogic.com] On Behalf Of Rahul
> > Saluja
> > Sent: maandag 12 oktober 2009 19:49
> > To: General Mark Logic Developer Discussion
> > Subject: [MarkLogic Dev General] Problem with update node
> >
> > hello all,
> >
> > I am trying to update a particular element in an xml document using
> > node-replace api, in the process of it i have been doing couple of
> > things
> >
> > here is the flow after getting the result from search i
> call another
> > query named update-write.xqy , which in turns call my function to
> > update the data into the database in process of doing so i am not
> > getting any error nor my data is getting updated, i am
> attaching code
> > for your reference for the same as i don't want this post to be too
> > big .
> > i am thinking culprit is me trying to find uri using
> >
> > <input type="hidden" name="calculatedUri"
> > value="{(xdmp:node-uri($book))}"/>
> >
> > consider starting point as
> >
> > 1)update-main-searchresult.xqy
> > which is calling
> > update-write.xqy on submit action
> >
> > 2) in update-write.xqy i am calling a function written in
> my another
> > module which is supposed to update the data but call is not
> reaching
> > there as in browser i can see title of update-main-searchresult.xqy
> >
> > i know its bit messy, but this is first time i am putting
> my hands on
> > it.
> >
> >
> >
> >
> > looking forward to your response.
> >
> > regards
> > Rahul
> >
> >
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
More information about the General
mailing list