<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/sc.schema.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>sc.schema</api:function-name><api:suggest>sc.schema</api:suggest><api:suggest>sc</api:suggest><api:suggest>schema</api:suggest><api:function-link mode="xquery" fullname="sc:schema">/apidoc/8.0/sc:schema.xml</api:function-link><api:function mode="javascript" name="schema" type="builtin" lib="sc" category="SchemaBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="sc" namespace="http://marklogic.com/xdmp/schema-components" fullname="sc.schema"><api:summary>
  <p xmlns="http://www.w3.org/1999/xhtml">Returns the root schema of the item.
  The context item is used if no argument is given.</p>
  <ul xmlns="http://www.w3.org/1999/xhtml"><li>If the item is a document node, the result is the schema of its
   root element.</li><li>If the item is an element node, the result is the schema of its
   element declaration.</li><li>If the item is an attribute node, the result is the schema of its
   attribute declaration.</li><li>If the item is a schema component, the result is the containing
   schema.</li><li>If the item is an atomic value, the result is the schema containing the
   type of that atomic value.</li><li>In other cases, the result is the empty sequence.</li></ul>
</api:summary><api:params><api:param name="arg" type="item()" optional="true"><api:param-description>
     The item whose associated schema is to be returned.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>schemaRoot()?</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.unquote('&lt;th:thesaurus xmlns:th="http://marklogic.com/xdmp/thesaurus"&gt;\n\
  &lt;th:entry&gt;&lt;th:term&gt;dog&lt;/th:term&gt;\n\
     &lt;th:synonym&gt;&lt;th:term&gt;canine&lt;/th:term&gt;&lt;/th:synonym&gt;\n\
  &lt;/th:entry&gt;\n\
&lt;/th:thesaurus&gt;').next().value.root.xpath(
  '//th:entry/sc:schema()!sc:component-property("schema-location")',
  {th:"http://marklogic.com/xdmp/thesaurus"});
  =&gt;
"thesaurus.xsd"
</pre></api:example></api:function></api:function-page>