xdmp.unquote( arg as String, [default-namespace as String?], [options as String[]] ) as Sequence
Parses a string as XML, returning one or more document nodes.
If no format is specified in $options, it is inferred from the input. If the first non-whitespace character is either '{' or '[' it is JSON. Otherwise it is XML.
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".
If $arg is the empty string, xdmp:unquote
returns an empty
document node.
fn.head(xdmp.unquote('<foo/>')); => <foo/> It returns this as a document node.
fn.head( xdmp.unquote('<foo>hello</foo>', null, ['repair-none', 'default-language=en']) ); => <foo xml:lang="en">hello</foo> It returns this as a document node and does not perform tag repair on the node.
fn.head( xdmp.unquote('<foo>hello</foo>', 'bar', ['repair-none', 'default-language=en']) ); => <foo xml:lang="en" xmlns="bar">hello</foo> It returns this as a document node and does not perform tag repair on the node. Note that the node is in the "bar" namespace.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.