<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.data.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.data</api:function-name><api:suggest>fn.data</api:suggest><api:suggest>fn</api:suggest><api:suggest>data</api:suggest><api:function-link mode="xquery" fullname="fn:data">/apidoc/8.0/fn:data.xml</api:function-link><api:function mode="javascript" name="data" type="builtin" lib="fn" category="AccessorBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.data"><api:summary>
 <p xmlns="http://www.w3.org/1999/xhtml">Takes a sequence of items and returns a sequence of atomic values. </p>
 <p xmlns="http://www.w3.org/1999/xhtml">The <code>fn:data</code> function returns the sequence of atomic values
 produced by applying the following rules to each item in $arg: </p>
<ul xmlns="http://www.w3.org/1999/xhtml"><li>If the item is an atomic value, it is returned.</li><li>If the item is a node:
  <ul><li>If the node does not have a typed value an error is
  raised [err:FOTY0012].</li><li>Otherwise, <code>fn:data</code> returns the typed value of the node as
  defined by the accessor function dm:typed-value in Section 5.15
  typed-value Accessor[DM].</li></ul></li></ul>
</api:summary><api:params><api:param name="arg" type="item()*"><api:param-description>
  The items whose typed values are to be returned.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>ValueIterator</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><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.data(x);

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