<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.quote.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.quote</api:function-name><api:suggest>xdmp.quote</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>quote</api:suggest><api:function-link mode="xquery" fullname="xdmp:quote">/apidoc/8.0/xdmp:quote.xml</api:function-link><api:function mode="javascript" name="quote" type="builtin" lib="xdmp" category="Extension" subcategory="XML" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.quote"><api:summary>
  Returns the unevaluated serialized representation
  of the input parameter as a string.
</api:summary><api:params><api:param name="arg" type="item()*"><api:param-description>
    Input to be quoted.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>ValueIterator</api:param-type></api:param><api:param name="options" type="(element()|map:map)?" optional="true"><api:param-description>

    The options node for this quote operation. The default value is
    <code xmlns="http://www.w3.org/1999/xhtml">
    <span class="javascript">null</span></code>.
    
    <p xmlns="http://www.w3.org/1999/xhtml">The
    <code>
    <span class="javascript">xdmp.quote</span></code> options include:</p>
    <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
      <dt><p>
	
      <span class="javascript">outputEncoding</span></p></dt>
      <dd>Specifies the encoding to use for this quote operation. This is
      only used to escape characters that cannot be represented.</dd>
      <dt><p>
	
      <span class="javascript">outputSgmlCharacterEntities</span></p></dt>
      <dd>Specifies if character entities should be output upon serialization
      of the XML.  Valid values are <code>normal</code>, <code>none</code>,
      <code>math</code>, and <code>pub</code>. 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.</dd>
      <dt><p>
	
      <span class="javascript">method</span></p></dt>
      <dd>Valid values are <code>xml</code>, <code>html</code>,
      <code>xhtml</code>, and <code>text</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>xsl:output</code></a> instruction.
      and the MarkLogic XQuery <code>xdmp:output</code> prolog statement.
      </dd>
      <dt><p>
	
      <span class="javascript">cdataSectionElements</span></p></dt>
      <dd>A 
      <span class="javascript">single QName or array of</span> QNames to output
      as CDATA sections. This is like the corresponding part of both the XSLT
      <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>xsl:output</code></a> instruction and the MarkLogic XQuery
      <code>xdmp:output</code> prolog statement.
      </dd>
      <dt><p>
	
      <span class="javascript">encoding</span></p></dt>
      <dd>The encoding.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>xsl:output</code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">useCharacterMaps</span></p></dt>
      <dd>One or more of the following values, 
      <span class="javascript">as a string or an array of strings.</span>
      Valid values are
      
      <span class="javascript"><code>xdmp:sgml-entities-normal</code>,</span>
      
      <span class="javascript"><code>xdmp:sgml-entities-math</code>,</span>
      and
      
      <span class="javascript"><code>xdmp:sgml-entities-pub</code>.</span>
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>xsl:output</code></a> instruction and the MarkLogic XQuery
      prolog statement.
      </dd>
      <dt><p>
	
      <span class="javascript">mediaType</span></p></dt>
      <dd>A mimetype representing a media type. For example,
      <code>text/plain</code> or <code>application/xml</code> (or other valid
      mimetypes).
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>xsl:output</code></a> instruction and the MarkLogic XQuery
      <code>xdmp:output</code> prolog statement.
      </dd>
      <dt><p>
	
      <span class="javascript">byteOrderMark</span></p></dt>
      <dd>Valid values are <code>yes</code> or <code>no</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">indent</span></p></dt>
      <dd>Specifies if typed XML (that is, XML for which there is an
      in-scope schema) should be pretty-printed (indented).  Valid
      values are <code>yes</code> or <code>no</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">indentUntyped</span></p></dt>
      <dd>Specifies if untyped XML (that is, XML for which there is no
      in-scope schema) should be pretty-printed (indented).  Valid
      values are <code>yes</code> or <code>no</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">indentTabs</span></p></dt>
      <dd>Specifies if tab characters should be used instead of 8 consecutive
      spaces when indenting.  Valid values are <code>yes</code> or <code>no</code>.
      </dd>
      <dt><p>
	
      <span class="javascript">includeContentType</span></p></dt>
      <dd>Include the content-type declaration when serializing the node.
      Valid values are
      <code>yes</code> or <code>no</code>.</dd>
      <dt><p>
	
      <span class="javascript">escapeUriAttributes</span></p></dt>
      <dd>Valid values are <code>yes</code> or <code>no</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">doctypePublic</span></p></dt>
      <dd>A public identifier, which is the public identifier to use on the
      emitted DOCTYPE.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">doctypeSystem</span></p></dt>
      <dd>A system identifier, which is the system identifier to use on the
      emitted DOCTYPE.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">omitXmlDeclaration</span></p></dt>
      <dd>Valid values are <code>yes</code> or <code>no</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">standalone</span></p></dt>
      <dd>Valid values are <code>yes</code> or <code>no</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">normalizationForm</span></p></dt>
      <dd>Valid values are <code>NFC</code>, <code>NFD</code>,
      and <code>NFKD</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
      <dt><p>
	
      <span class="javascript">defaultAttributes</span></p></dt>
      <dd>Specifies whether attributes defaulted with a schema should be
      included in the serialization.
      Valid values are <code>yes</code> or <code>no</code>.
      This is like the corresponding part of 
      the XSLT <a href="http://www.w3.org/TR/xslt20/#serialization">
      <code>
      <span class="javascript">xsl:output</span></code></a>
      instruction<span class="javascript">.</span>
      
      </dd>
    </dl></blockquote>

  </api:param-description><api:param-name>options</api:param-name><api:param-type>Object?</api:param-type></api:param></api:params><api:return>String</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var arg = xdmp.unquote("&lt;a&gt;aaa&lt;/a&gt;").toArray()[0].root;
var res = [];
res.push(arg);
res.push(xdmp.quote(arg));
res;

=&gt; ["&lt;a&gt;aaa&lt;/a&gt;", "&lt;a&gt;aaa&lt;/a&gt;"]
</pre></api:example></api:function></api:function-page>