Loading TOC...

xdmp:get

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 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 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.
"format-json"
Specifies to get the document as a JSON 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

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.