|
|
xdmp:document-get(
|
|
$location as xs:string,
|
|
[$options as node()]
|
| ) as node() |
|
 |
Summary:
Returns the document in the XML file specified by $location.
|
Parameters:
$location
:
The location of the input document. If the scheme of the location is
HTTP (that is, if the string starts with "http://"), then the document is
requested over HTTP. Otherwise, the document is fetched from the local
filesystem. On the filesystem, the path can be fully qualifed or relative.
Relative pathnames are resolved from the directory in which
MarkLogic Server is installed.
|
$options
(optional):
The options node for getting this document. The default value is ().
The node for the xdmp:document-get options must be in the
xdmp:document-get namespace. This parameter can also include
option elements in the xdmp:http namespace for the HTTP
parameters.
The xdmp:document-get options include:
<default-namespace>
- The namespace to use if there is no namespace at the root node of
the document. The default value is "".
<repair>
- A value of "full" specifies that malformed XML content be repaired.
A value of "none" specifies that malformed XML content is rejected.
This option has no effect on binary or text documents.
<format>
- A value of
text specifies to get the document as a
text document, regardless of the URI specified. A value of
binary specifies to get the document as a binary
document, regardless of the URI specified. A value of xml
specifies to get the document as an XML document, regardless of the
URI specified.
<lang>
- A value of "en" specifies that the document is in english.
|
|
Usage Notes:
If no format is specified in $options, and the document is from
an HTTP server, the format is specified by the document content type
from the HTTP response.
If no format is specified in $options, and the document is from
the filesystem, the format is specified by the document content type
from the filename extension.
The mimetype extensions and corresponding content types are set in the
Admin console.
If neither "repair" option is specified, malformed XML content
will be repaired.
When the document is from an HTTP server,
xdmp:document-get will always return the response from the
HTTP server, even if it is an error response such as 404 or 500. If you
want to be able to examine the response header in your application, use
the xdmp:http-get instead, which
returns both the response header and the response.
|
Example:
xdmp:document-get("myDocument.xml")
=> the xml contained in myDocument.xml,
for example, <myDocument/>
|
Example:
xdmp:document-get("myDocument.html",
<options xmlns="xdmp:document-get">
<repair>full</repair>
</options>)
=> myDocument.html as an XML document that has gone
through any needed tag repair
|
Example:
xdmp:document-get("http://myCompany.com/file.xml",
<options xmlns="xdmp:document-get"
xmlns:http="xdmp:http">
<format>xml</format>
<http:authentication>
<http:username>user</http:username>
<http:password>pass</http:password>
</http:authentication>
</options>)
=> gets an XML document named file.xml, sending the
authentication credentials user/pass to the
http://myCompany.com server
|
|
|
|
xdmp:eval(
|
|
$xquery as xs:string,
|
|
[$vars as item()*],
|
|
[$options as node()]
|
| ) as item()* |
|
 |
Summary:
Returns the result of evaluating a string
as an XQuery module.
|
Parameters:
$xquery
:
The XQuery string to be evaluated. If the XQuery string contains
double quotes ("), surround the string with single quotes (').
|
$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.
|
$options
(optional):
The options node. The default value is ().
The node for the xdmp:eval options must be in the
xdmp:eval namespace. The following is a sample options
node:
<options xmlns="xdmp:eval">
<isolation>different-transaction</isolation>
<prevent-deadlocks>true</prevent-deadlocks>
</options>
The xdmp:eval options include:
<database>
- The database ID, from
xdmp:database("db_name"),
xdmp:security-database(),
or xdmp:schema-database().
<modules>
- The modules database for processing module imports.
Specifying no
<modules> element in the
options node specifies the current modules database.
<root>
- The root path for modules.
Specifying no
<root> element in the options
node specifies the current root.
<timestamp>
- The system timestamp to use for this evaluation. Specifying
no
<timestamp> element in the
options node specifies the most recent timestamp. You may only
specify a timestamp for a query statement, not for an
update statement. The timestamp is a number that is incremented by
1 each time any configuration or content change is made to the system.
Specifying a timestamp of 0 uses the current system timestamp (the
value returned by xdmp:request-timestamp()). Specifying
a timestamp requires the xdmp:timestamp execute
privilege.
<isolation>
- (Only valid with
xdmp:eval or xdmp:invoke;
does not apply to xdmp:spawn.) Either
same-statement or
different-transaction. When set to
same-statement, the statement is evaluated in the same
transaction as the one from which it is called, and subsequent
expressions in the calling statement will not see any updates performed
in the eval/invoke/spawn. You can only use same-statement
isolation with update statements; query statements with
same-statement isolation will throw an exception. When set to
different-transaction, the statement is evaluated in
a separate transaction from the one in which it is called, making those
updates available to subsequent expressions in the calling statement
(assuming the calling statement is an update statement; if the calling
statement is not an update, then subsequent expressions will see the
version of the database at the system timestamp when the calling statement
begins its evaluation).
When using different-transaction in an update statement that
calls another update statement, do not update the same document as
the calling statement is updating; doing so can cause a deadlock.
You cannot evaluate a statement in a different database with the
isolation option set to same-statement.
The default value for the isolation option
is different-transaction. For more details, see the
"Understanding Transactions in MarkLogic Server" chapter of the
Developer's Guide.
<prevent-deadlocks>
- (Only valid with
xdmp:eval or xdmp:invoke;
does not apply to xdmp:spawn.)
Specify true for the server to disallow update requests
from an update transaction. Only has an effect when the
isolation option is set to different-transaction
as there is no possibility of a deadlock if the isolation
option is set to same-statement.
When set to true in an update request calling another
update request, MarkLogic Server throws the
XDMP-PREVENTDEADLOCKS
exception. Setting this option to true prevents
the possibility of deadlocks occurring when running eval/invoke of
an update transaction from another update transaction. The default value
for the prevent-deadlocks option is false.
|
|
Example:
|
Example:
declare namespace my='http://mycompany.com/test'
let $s :=
"declare namespace my='http://mycompany.com/test'
define variable $my:x as xs:string external
concat('hello ', $my:x)"
return
(: evaluate the query string $s using the variables
supplied as the second parameter to xdmp:eval :)
xdmp:eval($s, (xs:QName("my:x"), "world"))
=> hello world
|
Example:
xdmp:eval("doc('/docs/mydoc.xml')", (),
<options xmlns="xdmp:eval">
<database>{xdmp:database("otherdb")}</database>
</options>)
=> The '/docs/mydoc.xml' document from the
otherdb database.
|
|
|
|
xdmp:eval-in(
|
|
$xquery as xs:string,
|
|
$ID as xs:unsignedLong,
|
|
[$vars as item()*],
|
|
[$modules as xs:unsignedLong?],
|
|
[$root as xs:string?]
|
| ) as item()* |
|
 |
Summary:
[DEPRECATED--use xdmp:eval with the
database option instead] Returns the result of evaluating a string as
an XQuery module 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.
|
$modules
(optional):
The modules database for processing module imports.
The empty sequence specifies the current modules database.
|
$root
(optional):
The root path for modules.
The empty sequence specifies the current root.
|
|
Example:
xdmp:eval-in("1+1",2348790529)
=> 2
|
Example:
declare namespace my='http://mycompany.com/test'
let $s :=
"declare namespace my='http://mycompany.com/test'
define variable $my:x as xs:string external
concat('hello ', $my:x)"
return
(: evaluate the query string $s using the variables
supplied as the second parameter to xdmp:eval :)
xdmp:eval-in($s,
xdmp:database("Documents"),
(xs:QName("my:x"),
"world"))
=> hello world
|
|
|
|
xdmp:get(
|
|
$path as xs:string,
|
|
[$default-namespace as xs:string],
|
|
[$options as xs:string*]
|
| ) as node() |
|
 |
Summary:
[DEPRECATED] Returns the document in the XML file specified by $path.
This function is deprecated and will be removed from a future release.
Use xdmp:document-get instead.
|
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 MarkLogic
Server is installed.
|
$default-namespace
(optional):
Default namespace for nodes in the first parameter. 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:http-delete(
|
|
$uri as xs:string,
|
|
[$options as node()]
|
| ) as item()+ |
|
 |
Summary:
Sends an http DELETE request to the http server specified in the URI
to delete the specified resource. The server should respond if the
request is to be completed, but a response is not guaranteed.
Also, even if the server does respond, it
does not guarantee that the request has been or will be completed.
|
Parameters:
$uri
:
The URI of the document to delete.
|
$options
(optional):
The options node for this request. The default value is ().
The node for the xdmp:http-get options must be in the
xdmp:http namespace.
The xdmp:http-delete options include:
<headers>
- A sequence of <name>value</name> pairs. The names can be
anything, but many HTTP servers understand HTTP names such as
content-type. These are turned into name:value HTTP
headers. An error is raised if the child elements of the
<headers> option are not of the form
<name>value</name>.
<authentication>
- The credentials and the authentication method to use for
this request. This option has child elements for the
username and password.
The username is the name of the user to be authenticated
on the http server. The password is that user's password.
You can optionally specify a method attribute on the
<authentication> element. If it is specified it must be either
'basic' or 'digest'. If a method is specified and the HTTP server
requests a different type of authentication, then an error is raised.
If the attribute is not specified, or matches the server's requested
method, the authentication proceeds.
<timeout>
- The amount of time, in seconds, to wait until the HTTP connection
times out. The default value is the request timeout for the
HTTP server.
|
|
Usage Notes:
The http functions only operate on URIs that use the http scheme;
specifying a URI that does not begin with http:// throws an
exception.
If an http function times out, it throws a socket received
exception (SVC-SOCRECV).
Note the the xdmp:http-delete function simply sends
a DELETE request to the specified web server; what happens with the
DELETE request depends on the web server. The request does not delete a
document from a MarkLogic Server database. To delete a document
from a database, use the
xdmp:document-delete
function.
|
Example:
xdmp:http-delete("http://www.my.com/document.xhtml",
<options xmlns="xdmp:http">
<authentication method="basic">
<username>myname</username>
<password>mypassword</password>
</authentication>
</options>)
=> an optional response from the server
|
|
|
|
xdmp:http-get(
|
|
$uri as xs:string,
|
|
[$options as node()]
|
| ) as item()+ |
|
 |
Summary:
Sends the http GET method to the specified URI. Returns the http response
as well as whatever information is identified by the specified URI
(for example, an html document).
|
Parameters:
$uri
:
The URI of the requested document.
|
$options
(optional):
The options node for this request. The default value is ().
The node for the xdmp:http-get options must be in the
xdmp:http namespace. This parameter can also include
certain option elements (for example, repair) in the
xdmp:document-load and xdmp:document-get
namespaces.
The xdmp:http-get options include:
<headers>
- A sequence of <name>value</name> pairs. The names can be
anything, but many HTTP servers understand HTTP names such as
content-type. These are turned into name:value HTTP
headers. An error is raised if the child elements of the
<headers> option are not of the form
<name>value</name>.
<authentication>
- The credentials and the authentication method to use for
this request. This option has child elements for the
username and password.
The username is the name of the user to be authenticated
on the http server. The password is that user's password.
You can optionally specify a method attribute on the
<authentication> element. If it is specified it must be either
'basic' or 'digest'. If a method is specified and the HTTP server
requests a different type of authentication, then an error is raised.
If the attribute is not specified, or matches the server's requested
method, the authentication proceeds.
<timeout>
- The amount of time, in seconds, to wait until the HTTP connection
times out. The default value is the request timeout for the
HTTP server.
|
|
Usage Notes:
The http functions only operate on URIs that use the http scheme;
specifying a URI that does not begin with http:// throws an
exception.
If an http function times out, it throws a socket received
exception (SVC-SOCRECV).
The second node in the output of xdmp:http-get is the
response from the http server. The response is treated as
text, XML, or binary, depending on the content-type header sent from the
http server. If the node is html, the header should indicate
text/html, which is returned as a text document by default.
The type of document is determined by the mimetypes mappings, and
you can change the mappings in the Admin Interface as needed.
If you happen to know that the response is XML, even if the header
does not specify it as XML, and want to process the response as XML,
you can wrap the response in an xdmp:unquote call to
parse the response as XML. You could also use the
<format>xml</format> option (in the
xdmp:document-get namespace) to tell the API to treat the
document as XML. Also, if you know the response is an HTML document,
you can wrap the response in an xdmp:tidy call, which
will treat the text as HTML, clean it up, and return an XHTML XML
document.
|
Example:
xdmp:http-get("http://www.my.com/document.xhtml",
<options xmlns="xdmp:http">
<authentication method="basic">
<username>myname</username>
<password>mypassword</password>
</authentication>
</options>)
=> the response from the server as well as the specified document
|
Example:
xdmp:unquote(
xdmp:http-get("http://www.my.com/somexml.xml")[2])
=> The specified xml document, parsed as XML by
xdmp:unquote. If the header apecifies a
mimetype that is configured to be treated as
XML, the xdmp:unquote call is not needed.
Alternately, you can treat the response as XML
by specifying XML in the options node as
follows (note that the format option is in
the "xdmp:document-get" namespace:
xdmp:http-get("http://www.my.com/somexml.xml",
<options xmlns="xdmp:http-get">
<format xmlns="xdmp:document-get">xml</format>
</options>)[2]
|
Example:
xdmp:tidy(
xdmp:http-get("http://www.my.com/somehtml.html")[2])[2]
=> The specified html document, cleaned and transformed
to xhtml by xdmp:tidy. The second node of the tidy
output is the xhtml node (the first node is the status).
You could then perform XPath on the output to return
portions of the document. Note that the document (and
all of its elements) will be in the XHTML namespace, so
you need to specify the namespace in the XPath steps.
For example:
declare namespace xh="http://www.w3.org/1999/xhtml"
xdmp:tidy(
xdmp:http-get("http://www.my.com/somehtml.html")[2])[2]//xh:title
|
|
|
|
xdmp:http-head(
|
|
$uri as xs:string,
|
|
[$options as node()]
|
| ) as item()+ |
|
 |
Summary:
Sends the http HEAD method to the specified URI. Returns the http response
header for the specified URI.
|
Parameters:
$uri
:
The URI of the document whose response header is being requested.
|
$options
(optional):
The options node for this request. The default value is ().
The node for the xdmp:http-head options must be in the
xdmp:http namespace.
The xdmp:http-head options include:
<headers>
- A sequence of <name>value</name> pairs. The names can be
anything, but many HTTP servers understand HTTP names such as
content-type. These are turned into name:value HTTP
headers. An error is raised if the child elements of the
<headers> option are not of the form
<name>value</name>.
<authentication>
- The credentials and the authentication method to use for
this request. This option has child elements for the
username and password.
The username is the name of the user to be authenticated
on the http server. The password is that user's password.
You can optionally specify a method attribute on the
<authentication> element. If it is specified it must be either
'basic' or 'digest'. If a method is specified and the HTTP server
requests a different type of authentication, then an error is raised.
If the attribute is not specified, or matches the server's requested
method, the authentication proceeds.
<timeout>
- The amount of time, in seconds, to wait until the HTTP connection
times out. The default value is the request timeout for the
HTTP server.
|
|
Usage Notes:
The http functions only operate on URIs that use the http scheme;
specifying a URI that does not begin with http:// throws an
exception.
If an http function times out, it throws a socket received
exception (SVC-SOCRECV).
|
Example:
xdmp:http-head("http://www.my.com/document.xhtml",
<options xmlns="xdmp:http">
<authentication method="basic">
<username>myname</username>
<password>mypassword</password>
</authentication>
</options>)
=> the response from the server as well as the specified document
|
|
|
|
xdmp:http-post(
|
|
$uri as xs:string,
|
|
[$options as node()]
|
| ) as item()+ |
|
 |
Summary:
Sends the http POST request to the server.
|
Parameters:
$uri
:
The URI to which the data is to be posted.
|
$options
(optional):
The options node for this request. The default value is ().
The node for the xdmp:http-post options must be in the
xdmp:http namespace.
The xdmp:http-post options include:
<data>
- This node can contain any string. Anything in the
data
node is sent as a string in the PUT or POST body. When POSTing to a web
service, the data usually needs to be a SOAP XML structure. If you put
an XML structure in the data element, it will return
an error. Therefore, if you need the data to include a payload that is
an XML structure, you should use xdmp:quote to encode
the XML as a string. See the example
below for a data node that uses xdmp:quote.
<headers>
- A sequence of <name>value</name> pairs. The names can be
anything, but many HTTP servers understand HTTP names such as
content-type. These are turned into name:value HTTP
headers. An error is raised if the child elements of the
<headers> option are not of the form
<name>value</name>.
<authentication>
- The credentials and the authentication method to use for
this request. This option has child elements for the
username and password.
The username is the name of the user to be authenticated
on the http server. The password is that user's password.
You can optionally specify a method attribute on the
<authentication> element. If it is specified it must be either
'basic' or 'digest'. If a method is specified and the HTTP server
requests a different type of authentication, then an error is raised.
If the attribute is not specified, or matches the server's requested
method, the authentication proceeds.
<timeout>
- The amount of time, in seconds, to wait until the HTTP connection
times out. The default value is the request timeout for the
HTTP server.
|
|
Usage Notes:
The http functions only operate on URIs that use the http scheme;
specifying a URI that does not begin with http:// throws an
exception.
If an http function times out, it throws a socket received
exception (SVC-SOCRECV).
If you expect the request body from this http function to be
processed by another application (via a web service, for example),
you must specify a content-type header. If no content-type header is
specified, the content type defaults to application/x-www-form-urlencoded
and the request body will be empty (the request is still accessible via
the request fields).
|
Example:
xdmp:http-post("http://www.my.com/document.xhtml",
<options xmlns="xdmp:http">
<authentication method="basic">
<username>myname</username>
<password>mypassword</password>
</authentication>
</options>)
=> the response from the server as well as the specified document
|
Example:
(: Use xdmp:unquote to encode the XML as a string
because the <data> options element is a string :)
let $payload := xdmp:quote(
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:my='urn:MyConnection'>
<SOAP-ENV:Body>
<my:LogOn>
<my:User>user</my:User>
<my:Password>pass</my:Password>
<my:Ticket>abc123</my:Ticket>
<my:newData>1234</my:newData>
</my:LogOn>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
)
return
xdmp:http-post("http://www.my.com/document.xhtml",
<options xmlns="xdmp:http">
<authentication method="basic">
<username>myname</username>
<password>mypassword</password>
</authentication>
<data>{$payload}</data>
</options>)
=> the response from the server as well as the specified document
|
|
|
|
xdmp:http-put(
|
|
$uri as xs:string,
|
|
[$options as node()]
|
| ) as item()+ |
|
 |
Summary:
Sends an HTTP PUT request to an HTTP server.
The HTTP server should return a response, which will differ depending on
the action the HTTP server takes for the PUT.
|
Parameters:
$uri
:
The URI to which the data is to be put.
|
$options
(optional):
The options node for this request. The default value is ().
The node for the xdmp:http-put options must be in the
xdmp:http namespace.
The xdmp:http-put options include:
<data>
- This node can contain any string. Anything in the
data
node is sent as a string in the PUT or POST body.
<headers>
- A sequence of <name>value</name> pairs. The names can be
anything, but many HTTP servers understand HTTP names such as
content-type. These are turned into name:value HTTP
headers. An error is raised if the child elements of the
<headers> option are not of the form
<name>value</name>.
<authentication>
- The credentials and the authentication method to use for
this request. This option has child elements for the
username and password.
The username is the name of the user to be authenticated
on the HTTP server. The password is that user's password.
You can optionally specify a method attribute on the
<authentication> element. If it is specified it must be either
'basic' or 'digest'. If a method is specified and the HTTP server
requests a different type of authentication, then an error is raised.
If the attribute is not specified, or matches the server's requested
method, the authentication proceeds.
<timeout>
- The amount of time, in seconds, to wait until the HTTP connection
times out. The default value is the request timeout for the
HTTP server.
|
|
Usage Notes:
The http functions only operate on URIs that use the http scheme;
specifying a URI that does not begin with http:// throws an
exception.
If an http function times out, it throws a socket received
exception (SVC-SOCRECV).
If you expect the request body from this http function to be
processed by another application (via a web service, for example),
you must specify a content-type header. If no content-type header is
specified, the content type defaults to application/x-www-form-urlencoded
and the request body will be empty (the request is still accessible via
the request fields).
|
Example:
xdmp:http-put("http://www.my.com/document.xhtml",
<options xmlns="xdmp:http">
<authentication method="basic">
<username>myname</username>
<password>mypassword</password>
</authentication>
</options>)
=> the response from the HTTP server as well as the specified document
|
|
|
|
xdmp:invoke-in(
|
|
$uri as xs:string,
|
|
$ID as xs:unsignedLong,
|
|
[$vars as item()*],
|
|
[$modules as xs:unsignedLong?],
|
|
[$root as xs:string?]
|
| ) as item()* |
|
 |
Summary:
[DEPRECATED--use xdmp:invoke with the
database option instead] Returns the result of evaluating a module
at the given path.
|
Parameters:
$uri
:
The path of the module to be executed. The path is resolved against
the root of the App Server evaluating the query. The path must
resolve to a main module (not a library module).
|
$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.
|
$modules
(optional):
The modules database containing the module to invoke.
The empty sequence specifies the current modules database.
|
$root
(optional):
The root path for modules.
The empty sequence specifies the current root.
|
|
Example:
xdmp:invoke-in("http://example.com/modules/foo.xqy",2348790529)
=> 2
|
|
|
|
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. The default level is "info".
|
|
Example:
|
|
|
|
xdmp:set(
|
|
$var-name as node(),
|
|
$expr as node()
|
| ) as empty() |
|
 |
Summary:
Set the value of a variable to the specified expression. The
xdmp:set command allows you to introduce changes to the
state (side effects) of a query by changing the value of a variable to
something other than what it is bound to.
|
Parameters:
$var-name
:
The variable name.
|
$expr
:
An expression with which to set the variable.
|
|
Usage Notes:
When a variable is bound to a sequence in a for loop, and when
that variable is changed by xdmp:set in the return
clause, the change only effects the value for one iteration of the
for loop at a time; when the next value is sent to the return
clause, it is set to the next value in the sequence specified in the
for clause. The value only changes only after the
xdmp:set call is made.
|
Example:
(: set the value of the variable $x
to 1234 and then print out $x :)
let $x := 12
return
(xdmp:set($x, 1234), $x)
=> 1234
|
Example:
(: set the value of the variable $x
to 5 and then print out $x for
each value of $y :)
for $x in (1, 2)
for $y in ($x, $x)
return
($y, xdmp:set($x, 5), $x)
=> (1, 5, 1, 5, 2, 5, 2, 5)
|
Example:
(: note the effect on $z of changing the
value of $x :)
for $x in (1, 2)
for $y in (3,4)
for $z in ($x, $x)
return
($z, xdmp:set($x, 5))
=> (1, 1, 5, 5, 2, 2, 5, 5)
|
Example:
(: every time the name of the input node changes,
output the new name :)
let $n := ()
for $i in (<x>1</x>, <x>2</x>, <y>3</y>)
return (
if (name($i) eq $n)
then ()
else (xdmp:set($n, name($i)), $n)
, data($i)
)
=> (x, 1, 2, y, 3)
|
|
|
|
xdmp:spawn-in(
|
|
$path as xs:string,
|
|
$ID as xs:unsignedLong,
|
|
[$vars as item()*],
|
|
[$modules as xs:unsignedLong?],
|
|
[$root as xs:string?]
|
| ) as empty() |
|
 |
Summary:
[DEPRECATED--use xdmp:spawn with the
database option instead] Place the specified module on the task
queue for evaluation. It will be evaluated in the given database.
|
Parameters:
$path
:
The path, relative to the specified root, of the module to be executed.
|
$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.
|
$modules
(optional):
The modules database that contains the module to invoke.
The empty sequence specifies the current modules database.
|
$root
(optional):
The root path for modules.
The empty sequence specifies the current root.
|
|
Usage Notes:
The xdmp:spawn-in function places the specified XQuery
module in the task queue to be processed. The module will be evaluated
when the task server has the available resources to process it. The tasks
are processed in the order in which they are added to the queue.
|
Example:
xdmp:spawn-in("example.xqy",
324398742983742,
(),
xdmp:modules-database(),
"http://example.com/application/")
=> ()
Puts the module from the modules database with the
URI http://example.com/application/module.xqy
in the task server queue. The module will be
executed in the context of the database with
an ID of 324398742983742.
|
|
|
|
xdmp:unquote(
|
|
$arg as xs:string,
|
|
[$default-namespace as xs:string],
|
|
[$options as xs:string*]
|
| ) as document-node()+ |
|
 |
Summary:
Parses a string as XML, returning one or more document nodes.
|
Parameters:
$arg
:
Input to be unquoted.
|
$default-namespace
(optional):
Default namespace for nodes in the first parameter.
|
$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 XML.
If neither "repair-full" nor "repair-none" is present,
malformed XML content will be repaired.
If $arg is the empty string, xdmp:unquote returns an empty
document node.
|
Example:
xdmp:unquote("<foo/>")
=> <foo/>
It returns this as a document node.
|
|
|