Hi

Is there any way to get an XML document in JSON format in MarkLogic 7 using 
REST API?

In ML 6, I used custom transformation on raw document where I am converting XML 
document into JSON and returning it.

But in ML 7, the same code is not working because of REST API Changes. 
Converted JSON is returning as a string instead of an object.

Below is the code snippet in ML 7 Rest API, where it is fetching document 
mimetype ignoring the format we specify in REST URL.

let $uri-mimetype := xdmp:uri-content-type($uri)
    let $is-unknown   := ($uri-mimetype eq "application/x-unknown-content-type")
    let $format       :=
        let $mimetype-format :=
            if ($is-unknown) then ()
            else eput:get-outbound-type-format($uri-mimetype)
        let $uri-format      :=
            if ($is-unknown) then ()
            else if (exists($mimetype-format))
            then $mimetype-format
            else xdmp:uri-format($uri)
        return
            if (exists($uri-format))
            then $uri-format
            else eput:get-node-format($result)

if I change the above code to use the format I specy in REST URL to "json", 
everything is working as usual.

Can anyone suggest me if it is good to change the logic above to use the format 
parameter of REST API and emit the JSON? (if format=json then use as is else 
default logic)

Regards,
Gnanaprakash Bodireddy
Sr. Associate - Projects, Dublin Ireland
Mob: +353 87 964 9549



This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to