The extension functions provide miscellaneous extensions to XQuery.
xdmp:add64(11442580934957149475,14565934789622151058) => 7561771650869748917
xdmp:base64-decode( "c2xpbmdzIGFuZCBhcnJvd3Mgb2Ygb3V0cmFnZW91cyBmb3J0dW5l") => slings and arrows of outrageous fortune
xdmp:base64-encode("slings and arrows of outrageous fortune") => c2xpbmdzIGFuZCBhcnJvd3Mgb2Ygb3V0cmFnZW91cyBmb3J0dW5l
xdmp:castable-as( "http://www.w3.org/2001/XMLSchema", "integer", "12") => true()
xdmp:document-get-collections("chapter5.xml") =>("http://marklogic.com/all-books", "http://marklogic.com/xml-books")
xdmp:element-content-type() => "element-only"
install_dir/Config/email-xml.xsd
install_dir/Config/rfc822.xsd
install_dir
This example demonstrates sending a message with HTML content. xdmp:email( <em:Message xmlns:em="URN:ietf:params:email-xml:" xmlns:rf="URN:ietf:params:rfc822:"> <rf:subject>Sample HTML Email</rf:subject> <rf:from> <em:Address> <em:name>MarkLogic</em:name> <em:adrs>marklogic@yourdomain</em:adrs> </em:Address> </rf:from> <rf:to> <em:Address> <em:name>System Administrator</em:name> <em:adrs>admin@yourdomain</em:adrs> </em:Address> </rf:to> <em:content> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test HTML message</title> </head> <body> <h1>Test HTML message</h1> <p>Here is a simple paragraph</p> </body> </html> </em:content> </em:Message>)
This example demonstrate sending a message with plain text content. xdmp:email( <em:Message xmlns:em="URN:ietf:params:email-xml:" xmlns:rf="URN:ietf:params:rfc822:"> <rf:subject>Sample Plain Text Email</rf:subject> <rf:from> <em:Address> <em:name>MarkLogic</em:name> <em:adrs>marklogic@yourdomain</em:adrs> </em:Address> </rf:from> <rf:to> <em:Address> <em:name>System Administrator</em:name> <em:adrs>admin@yourdomain</em:adrs> </em:Address> </rf:to> <em:content xml:space="preserve"> This is a sample email with a plain text body. </em:content> </em:Message>)
xdmp:group("Default") => 134722342511344334243
xdmp:hash32("/a/b[1]/c") => 152930691
xdmp:hash64("/a/b[1]/c") => 5082244643751628547
xdmp:hex-to-integer("1234567890abcdef") => 1311768467294899695
xdmp:integer-to-hex(1234567890) => "499602d2"
xdmp:integer-to-octal(1234567890) => "11145401322"
xdmp:md5("foo") => "acbd18db4cc2f85cedef654fccc4a4d8"
xdmp:mul64(15107650474313474666,13290239292956375463) => 1404109880107289894
Returns an xs:string representing the node's kind: either "document", "element", "attribute", "text", "namespace", "processing-instruction", "binary", or "comment".
xs:string
The fn:node-kind builtin was dropped from the final XQuery 1.0 spec. This is the equivalent function in the xdmp: namespace carried over for MarkLogic 1.0 dialects.
fn:node-kind
xdmp:
let $x := <hello><goodbye>1</goodbye></hello> return xdmp:node-kind($x/node()) => element
xdmp:octal-to-integer("12345670") => 2739128
xdmp:random(100) => 47
xdmp:sleep(1000) => ()
The supported format strings differ for different platforms. For the supported format strings for Windows, see the following link:
http://msdn2.microsoft.com/en-us/library/fe06s4ak(VS.80).aspx
For the supported format strings for Solaris, see the following link:
http://docs.sun.com/app/docs/doc/817-5438/6mkt5pcec?a=view
For the supported format strings for Linux, see the following link:
http://linux.about.com/library/cmd/blcmdl3_strftime.htm
xdmp:strftime("%a, %d %b %Y %H:%M:%S",current-dateTime()) => Tue, 08 Apr 2003 17:21:37
xdmp:user-last-login(xdmp:user("sylvester")) => <last-login xmlns="http://marklogic.com/xdmp/last-login"> <user-id>1134406269933351074</user-id> <last-successful-login>2008-03-19T15:41:08</last-successful-login> <last-unsuccessful-login>2008-03-19T15:40:45</last-unsuccessful-login> <number-unsuccessful-logins>0</number-unsuccessful-logins> <display-last-login>true</display-last-login> </last-login>