|
|
xdmp:document-get(
|
|
$location as xs:string,
|
|
[$options as node()?]
|
| ) as node() |
|
 |
Summary:
Returns the document in the 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.
If no repair option is explicitly specified, the default is
implicitly specified by the XQuery version of the caller.
In XQuery 1.0 and 1.0-ml the default
is none. In XQuery 0.9-ml the
default is full.
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.
<default-language>
- The language to specify in an
xml:lang attribute on the
root element node if the root element node does not already have an
xml:lang attribute. If default-language is
not specified, then nothing is added to the root element node.
<encoding>
- Specifies the encoding to use when reading the document into MarkLogic
Server. Supported values include
UTF-8,
ISO-8859-1, as well as many other popular encodings.
See the Search Developer's Guide for a list of character set
encodings by
language. All encodings will be translated into UTF-8
from the specified encoding. The string specifed for the
encoding option will be matched to an encoding name according
to the Unicode Charset Alias Matching rules
(http://www.unicode.org/reports/tr22/#Charset_Alias_Matching).
If no encoding option is specified, the encoding defaults to the
encoding specified in the http header (if using with one of the http
functions, for example, xdmp:http-get), otherwise it defaults
to UTF-8.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/xdmp-document-get
|
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 Interface.
If no repair option is specified,
the default is specified by the XQuery version of the caller.
In XQuery version 1.0 and 1.0-ml the default is
<repair>none</repair>. In XQuery version
0.9-ml the default is
<repair>full</repair>.
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:get(
|
|
$path as xs:string,
|
|
[$default-namespace as xs:string?],
|
|
[$options as xs:string*]
|
| ) as node() |
|
 |
Summary:
[DEPRECATED: use xdmp:document-get
instead] 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 Interface.
If neither "repair-full" nor "repair-none" is present,
the default is specified by the XQuery version of the caller.
In XQuery version 1.0 and 1.0-ml the default is
"repair-none". In XQuery version 0.9-ml the default is
"repair-full".
|
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-sequence() |
|
 |
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:
|
|
|