简体   繁体   中英

Marklogic XQuery to Javascript

I am trying to port an implementation in XQuery onto JS. There is this piece of code in XQuery:

document{$item}/node()

that retrieves an XML document.

Could any one please let me know how an equivalent implementation using MarkLogic JS API could look like?

The XQuery appears to be constructing an XML document instead of retrieving it.

If so, the equivalent Server-Side JavaScript would be:

new NodeBuilder().addDocument(item).toNode().root

For more information, see:

http://docs.marklogic.com/NodeBuilder.addDocument

To retrieve a document, cts.doc() is useful. To retrieve many documents in a single call, use fn.doc()

Hoping that helps,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM