Loading TOC...

sc.annotations

sc.annotations(
   [arg as schemaComponent()]
) as Sequence

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

// 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>
//

var ns = {"ex":"http://example.com/dummy", "app":"http://example.com/appinfo"};
var e = fn.head(cts.doc("example.xml").xpath("/ex:root/element()[1]", ns));
var ann = fn.head(sc.annotations(e.elementDecl));
fn.head(ann.xpath(".//app:hidden", ns)).data;
  =>
false()

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.