I believe the request-body node itself will always be a document-node. So step
down a level before testing it. You could use boolean expressions like these:
$req-body/node() instance of binary()
$req-body/node() instance of text()
$req-body/node() instance of element()
Or it might be convenient to use a typeswitch:
let $body := xdmp:get-request-body()/node()
return typeswitch($body)
case element() return handle-element($body)
case binary() return handle-binary($body)
case text() return handle-text($body)
default return error((), 'UNEXPECTED', $body)
-- Mike
On 25 Feb 2013, at 13:12 , Raghu <[email protected]> wrote:
> HI all,
>
> I have a requirement
>
> let $req-body := xdmp:get-request-body()
> return
> if ($req-body is a valid xml) then
> invoke xmlprocessor.xqy
> else
> invoke binaryprocessor.xqy
>
> what is the best way to validate, if the request body is an xml or
> binary(non-xml) content??
>
>
> Thanks in advance.
> Raghu
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general