| XQUERY/XSLT API DOCUMENTATION 4.2 |
All XQuery & XSLT Functions MarkLogic Built-In Functions Admin (xdmp:) AppServer (xdmp:) Classifier (cts:) Debug (dbg:) Document Conversion (xdmp:) Extension (xdmp:) Documents, Directories, Properties, and Locks Functions Extension Functions Function Values Functions HTTP Functions JSON Functions MarkLogic Server Functions Search Functions XML Functions XQuery Context Functions XSLT Functions map (map:) Math (math:) Profile (prof:) Search (cts:) cts:query Constructors Functions Geospatial Functions Geospatial Lexicon Functions Lexicon Functions Search Functions Search Clustering Functions Security (xdmp:) Server Monitoring (xdmp:) Spell (spell:) Update (xdmp:) XQuery Library Modules Admin Library (admin:) Actions Functions Appserver Functions Database Functions Forest Functions Group Functions Host Functions Mimetypes Functions Scheduler Functions Alerting (alert:) Elastic Compute Cloud (ec2:) Entity Enrichment (entity:) Flexible Replication (flexrep:) Geospatial Supporting Functions GEO Functions GeoRSS Functions GML Functions KML Functions MCGM Functions Information Studio (info:) Information Studio Developer (infodev:) Library Services (dls:) cts:query Constructor Functions Document Management Functions Document Update Functions Retention Policy Functions XInclude Functions Modular Documents XInclude Functions XPointer Functions PKI (pki:) Plugin (plugin:) Search (search:) Security-sec (sec:) Spelling Dictionary Management (spell:) Thesaurus (thsr:) Triggers (trgr:) Triggers Library (trgr:) WordProcessingML (ooxml:) ZIP Package (ooxml:) CPF Functions Content Processing Framework (cpf:) CSS Conversion (css:) DocBook Conversion (dbk:) Domains (dom:) Excel Conversion (excel:) Generic Conversion (cvt:) Links (lnk:) MSWord Conversion (msword:) PDF Conversion (pdf:) Pipelines (p:) Powerpoint Conversion (ppt:) XHTML Conversion (xhtml:) W3C-Standard Functions Accessor (fn:) AnyURI (fn:) Boolean (fn:) Context (fn:) DurationDateTime (fn:) Error and Trace (fn:) Node (fn:) Numeric (fn:) QName (fn:) Sequence (fn:) String (fn:) XSLT (fn:) W3C XQuery/XSLT Reference W3C XQuery Functions W3C XQuery Language W3C XSLT Language
This page was generated September 12, 2012 5:59 AM | XQuery & XSLT Built-In & Modules Function Reference
Built-In: Extension - XML Functions
The XML extension functions provide XML functionality such as parsing a string as XML.
Function Summary
xdmp:quote | Returns the unevaluated serialized representation of the input parameter as a string.
xdmp:unquote | Parses a string as XML, returning one or more document nodes.
Function Detail
xdmp:quote(
| $arg as item()*,
| [$options as node()?]
) as xs:string
Summary: Returns the unevaluated serialized representation of the input parameter as a string.
Parameters:
$arg : Input to be quoted.
$options (optional): The options node for this quote operation. The default value is (). The node for the xdmp:quote options must be in the `xdmp:quote` namespace. The `xdmp:quote` options include: <output-encoding> Specifies the encoding to use for this quote operation. This is only used to escape characters that cannot be represented. <output-sgml-character-entities> Specifies if character entities should be output upon serialization of the XML. Valid values are `normal`, `none`, `math`, and `pub`. By default (that is, if this option is not specified), no SGML entities are serialized on output, unless the App Server is configured to output SGML character entities. <method> Valid values are `xml`, `html`, `xhtml`, and `text`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <cdata-section-elements> A list of QNames to output as CDATA sections. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <encoding> The encoding. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <use-character-maps> Valid values are `xdmp:sgml-entities-normal`, `xdmp:sgml-entities-math`, and `xdmp:sgml-entities-pub`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <media-type> A mimetype representing a media type. For example, `text/plain` or `text/xml` (or other valid mimetypes). This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <byte-order-mark> Valid values are `yes` or `no`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <indent> Specifies if typed XML (that is, XML for which there is an in-scope schema) should be pretty-printed (indented). Valid values are `yes` or `no`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <indent-untyped> Specifies if untyped XML (that is, XML for which there is no in-scope schema) should be pretty-printed (indented). Valid values are `yes` or `no`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <include-content-type> Include the content-type declaration when serializing the node. Valid values are `yes` or `no`. <escape-uri-attributes> Valid values are `yes` or `no`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <doctype-public> A public identifier, which is the public identifier to use on the emitted DOCTYPE. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <doctype-system> A system identifier, which is the system identifier to use on the emitted DOCTYPE. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <omit-xml-declaration> Valid values are `yes` or `no`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <standalone> Valid values are `yes` or `no`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <normalization-form> Valid values are `NFC`, `NFD`, and `NFKD`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement. <default-attributes> Specifies whether attributes defaulted with a schema should be included in the serialization. Valid values are `yes` or `no`. This is like the corresponding part of both the XSLT `xsl:output` instruction and the MarkLogic XQuery `xdmp:output` prolog statement.
Example:
      let $arg := <a>aaa</a>
      return ($arg, xdmp:quote($arg))
      => (<a>aaa</a>, "<a>aaa</a>")
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. "default-language=xx" If the root element node specified in the first parameter does not already have an `xml:lang` attribute, the language to specify in an `xml:lang` attribute on the root element node. If `default-language` is not specified, then nothing is added to the root element node. Some examples are `default-language=en` and `default-language=fr`.
Usage Notes: If no format is specified in $options, 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.
Example:
      xdmp:unquote("<foo/>")
      => <foo/>
      It returns this as a document node.
Example:
      xdmp:unquote('<foo>hello</foo>', "",
              ("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.

© Copyright 2002-2012 MarkLogic Corporation. All rights reserved.