<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/sc.annotations.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>sc.annotations</api:function-name><api:suggest>sc.annotations</api:suggest><api:suggest>sc</api:suggest><api:suggest>annotations</api:suggest><api:function-link mode="xquery" fullname="sc:annotations">/apidoc/8.0/sc:annotations.xml</api:function-link><api:function mode="javascript" name="annotations" type="builtin" lib="sc" category="SchemaBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="sc" namespace="http://marklogic.com/xdmp/schema-components" fullname="sc.annotations"><api:summary>
  <p xmlns="http://www.w3.org/1999/xhtml">Returns the schema annotations of the component, if any.
  The context item is used if no argument is given.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Annotations will only be returned for schemas that have preservation
  of them enabled with the "xdmp-annotations" processing instruction.
  The annotations returned will only include the appinfo children of the
  annotations unless the schema has the "all" parameter set in the
  "xdmp-annotations" processing instruction.
  </p>
</api:summary><api:params><api:param name="arg" type="schema-component()" optional="true"><api:param-description>
     The item whose annotations are to be returned.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>schemaComponent()</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">
// Get the annotations on the element declaration for the first child of 
// the root of the document "example.xml". Look in those annotations for the
// app:hidden element and get its value. The element declaration might
// have a declaration that includes:
//   &lt;xs:annotation&gt;
//     &lt;xs:appinfo&gt;
//        &lt;app:hidden xmlns="http://example.com/appinfo"&gt;false&lt;/app:hidden&gt;
//        &lt;app:default xmlns="http://example.com/appinfo"&gt;47&lt;/app:default&gt;
//     &lt;/xs:appinfo&gt;
//   &lt;/xs:annotation&gt;
//

var ns = {"ex":"http://example.com/dummy", "app":"http://example.com/appinfo"};
var e = cts.doc("example.xml").xpath("/ex:root/element()[1]", ns).next().value;
var ann = sc.annotations(e.elementDecl).next().value;
ann.xpath(".//app:hidden", ns).next().value.data;
  =&gt;
false()
</pre>
</api:example></api:function></api:function-page>