<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.string.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.string</api:function-name><api:suggest>fn.string</api:suggest><api:suggest>fn</api:suggest><api:suggest>string</api:suggest><api:function-link mode="xquery" fullname="fn:string">/apidoc/8.0/fn:string.xml</api:function-link><api:function mode="javascript" name="string" type="builtin" lib="fn" category="AccessorBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.string"><api:summary>
 Returns the value of $arg represented as an <code xmlns="http://www.w3.org/1999/xhtml">xs:string</code>. If no
 argument is supplied, this function returns the string value of the
 context item (.).
</api:summary><api:params><api:param name="arg" type="item()?" optional="true"><api:param-description>
The item to be rendered as a string.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>String?</api:param-type></api:param></api:params><api:return>String?</api:return><api:usage>
If no argument is supplied and the context item is undefined, an error is
raised.
<p xmlns="http://www.w3.org/1999/xhtml">
If $arg is the empty sequence, the zero-length string is returned.
</p><p xmlns="http://www.w3.org/1999/xhtml">
If $arg is a node, the function returns the string-value of the node, as
obtained using the dm:string-value accessor.
</p>
If $arg is an atomic value, then the function returns the same string as is
returned by the expression:<br xmlns="http://www.w3.org/1999/xhtml"/><br xmlns="http://www.w3.org/1999/xhtml"/><code xmlns="http://www.w3.org/1999/xhtml">$arg cast as xs:string</code>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var x = xdmp.unquote('&lt;hello&gt;hello&lt;goodbye&gt;goodbye&lt;/goodbye&gt;&lt;/hello&gt;')
    .toArray()[0].xpath("/hello");
fn.string(x);

=&gt; hellogoodbye
</pre>
</api:example></api:function></api:function-page>