Hi, Vikas:

You can create, install, and write documents with a transform that executes

    validate strict { $document }

If the document is valid, the expression will merely return the document; 
otherwise, it will throw an error.

Here's the documentation for transforms in the REST API and for the validate 
expression:

    http://docs.marklogic.com/guide/rest-dev/transforms
    http://docs.marklogic.com/guide/xquery/langoverview#id_55039

For more control over the HTTP error, you can wrap the validate in a try / 
catch (or use the xdmp:validate() function instead of the validate expression) 
and throw RESTAPI-EXTNERR in the catch.  Please see:

    http://docs.marklogic.com/guide/rest-dev/transforms#id_50497


Hoping that helps,


Erik Hennum

________________________________
From: [email protected] 
[[email protected]] on behalf of 
[email protected] [[email protected]]
Sent: Wednesday, August 27, 2014 5:49 AM
To: [email protected]
Subject: [MarkLogic Dev General] validate document using document rest api

Hi

I am using PUT method of document rest api for ingesting content but I want to 
validate xml document before ingestion using schema .How can I achieve this 
within Marklogic using document rest api ?.

Regards,
Vikas Singh
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