|
|
Built-In: Extension
|
|
The extension built-in functions are miscellaneous extensions to the
XQuery core library, including functions for evaluating
strings as XQuery expressions and functions to get information about
documents in the database.
|
|
|
|
 |
|
Function Detail
|
 |
|
xdmp:databases
( ) as xs:unsignedLong*
|
|
 |
Summary:
Returns a sequence of the ids of all the databases in the system.
|
|
|
Example:
xdmp:databases()
=> (14389140626518478220,
8456374036761185098,
10615125154705099114)
|
 |
|
 |
|
xdmp:email(
|
|
$message as node()
|
| ) as empty() |
|
 |
Summary:
Send an email in an XQuery program. A valid SMTP Relay must be
configured in the Groups page of the Admin console for the email to be
sent. The format of the email message must be an XML file that
complies with the schema files listed below.
|
Parameters:
$message
:
An XML representation of an email message to send. The message must
comply with the XML schemas defined in the following schema files:
install_dir/config/email-xml.xsd
install_dir/config/rfc822.xsd
where install_dir is the directory in which
Content Interaction Server is installed.
|
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/xdmp-email
|
|
|
Example:
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>Mark Logic</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>)
|
Example:
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>Mark Logic</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:eval-in(
|
|
$xquery as xs:string,
|
|
$ID as xs:unsignedLong,
|
|
[$vars as item()*]
|
| ) as item()* |
|
 |
Summary:
Returns the result of evaluating a string
as an XQuery in a given database.
|
Parameters:
$xquery
:
The XQuery string to be evaluated. If the XQuery string contains
double quotes ("), surround the string with single quotes (').
|
$ID
:
The database ID, from xdmp:database("db_name"),
xdmp:security-database(),
or xdmp:schema-database().
|
$vars
(optional):
The external variable values for this evaluation.
This must be a sequence of even length, alternating QNames and items.
Each QName and item pair specify a variable name and value.
|
|
|
|
Example:
xdmp:eval-in("1+1",2348790529)
=> 2
|
Example:
let $s :=
"define variable $x as xs:string external
concat('hello ', $x)"
return
(: evaluate the query string $s using the variables
supplied as the third argument to xdmp:eval-in :)
xdmp:eval-in($s,
xdmp:database("Documents"),
(xs:QName("x"),
"world"))
=> hello world
|
 |
|
 |
|
xdmp:forests
( ) as xs:unsignedLong*
|
|
 |
Summary:
Returns a sequence of the ids of all the forests in the system.
|
|
|
Example:
xdmp:forests()
=> 18263538320779601865
2760886727871312968
1551965607977434000
2714941248661564752
|
 |
|
 |
|
xdmp:get(
|
|
$path as xs:string,
|
|
[$default-namespace as xs:string],
|
|
[$options as xs:string*]
|
| ) as xs:node() |
|
 |
Summary:
Returns the document in the XML file specified by $path.
|
Parameters:
$path
:
The path to the input file. The path can be fully qualifed or relative.
Relative pathnames are resolved from the directory in which Content
Interaction Server is installed.
|
$default-namespace
(optional):
Default namespace for nodes in the first argument. If $default-namespace is
specified and the root node of the loaded document does not explicitly
specify a namespace, $default-namespace will be applied to the root node.
The default value for $default-namespace is "".
|
$options
(optional):
The options for getting this document.
The default value is ().
Options include:
- "repair-full"
- Specifies that malformed XML content be repaired.
This option has no effect on binary or text documents.
- "repair-none"
- Specifies that malformed XML content be rejected.
This option has no effect on binary or text documents.
- "format-text"
- Specifies to get the document as a text document,
regardless of the URI specified.
- "format-binary"
- Specifies to get the document as a binary document,
regardless of the URI specified.
- "format-xml"
- Specifies to get the document as an XML document,
regardless of the URI specified.
- "lang=en"
- Specifies that the document is in english.
|
|
|
Usage Notes:
If no format is specified in $options, it is specified by the
document content type specified by the extension of the document URI.
The mimetype extensions and corresponding content types are set in the
Admin console.
If neither "repair-full" nor "repair-none" is present,
malformed XML content will be repaired.
|
|
Example:
xdmp:get("foo.xml")
=> <foo/>
|
Example:
xdmp:get("foo.html", "", ("repair-full", "format-xml"))
=> foo.html as an XML document that has gone through any
needed tag repair
|
 |
|
 |
|
xdmp:log(
|
|
$msg as item()*,
|
|
[$level as xs:string]
|
| ) as empty() |
|
 |
Summary:
Logs a debug message to the log file <install_dir>/Logs/ErrorLog.txt.
|
Parameters:
$msg
:
Message for logging.
|
$level
(optional):
One of: emergency, alert, critcal, error, warning, notice, info,
config, debug, fine, finer, or finest.
|
|
|
|
Example:
xdmp:log("AAAA")
=> ()
|
 |
|
 |
|
xdmp:node-uri
( ) as xs:string
|
|
 |
Summary:
Returns the document-uri property of the argument or its ancestor.
|
|
|
Example:
xdmp:node-uri(doc("http://marklogic.com/document"))
=> "http://marklogic.com/document"
|
 |
|
 |
|
xdmp:path(
|
|
$node as node(),
|
|
[$includeDocument as xs:boolean]
|
| ) as xs:string |
|
 | | | |