MarkLogic 9 Product Documentation
sc:annotations

sc:annotations(
   [$arg as schema-component()]
) as element()*

Summary

Returns the schema annotations of the component, if any. The context item is used if no argument is given.

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.

Parameters
arg The item whose annotations are to be returned.

Example

<?xdmp-annotations?> <!-- Preserve annotations -->
<?xdmp-annotations all?> <!-- Preserve documentation annotations -->

Example

(: 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:
   <xs:annotation>
     <xs:appinfo>
        <app:hidden xmlns="http://example.com/appinfo">false</app:hidden>
        <app:default xmlns="http://example.com/appinfo">47</app:default>
     </xs:appinfo>
   </xs:annotation>
:)
declare namespace ex="http://example.com/dummy";
declare namespace app="http://example.com/appinfo";

fn:data(doc("example.xml")/ex:root/element()[1]
  /sc:element-decl()!sc:annotations()//app:hidden)
  =>
false()
Powered by MarkLogic Server | Terms of Use | Privacy Policy