<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/sc.typeApply.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>sc.typeApply</api:function-name><api:suggest>sc.typeapply</api:suggest><api:suggest>sc</api:suggest><api:suggest>typeapply</api:suggest><api:function-link mode="xquery" fullname="sc:type-apply">/apidoc/8.0/sc:type-apply.xml</api:function-link><api:function mode="javascript" name="typeApply" type="builtin" lib="sc" category="SchemaBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="sc" namespace="http://marklogic.com/xdmp/schema-components" fullname="sc.typeApply"><api:summary>
  Apply a type to an item to construct a typed instance of that type.
  If the type is a simple type this amounts to casting.
  If the type is a complex type this amounts to validating as that type.
</api:summary><api:params><api:param name="type" type="schema-type()"><api:param-description>
     The type to apply.
  </api:param-description><api:param-name>type</api:param-name><api:param-type>schemaType()</api:param-type></api:param><api:param name="arg" type="item()"><api:param-description>
     The item to apply the type to.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>String</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">
sc.typeApply( sc.typeNamed(xs.QName('xs:integer')), "47" );
  =&gt; 47
</pre></api:example></api:function></api:function-page>