Loading TOC...

MarkLogic 10 Product Documentation
sc.elementDecl

sc.elementDecl(
   [arg as Item]
) as elementDecl()?

Summary

Returns the element declaration of item, as a schema component, if any. If the item has no element declaration, the empty sequence is returned. The context item is used if no argument is given.

Parameters
arg The item whose element declaration is to be returned.

Example

var th = 
  fn.head(xdmp.unquote('<th:thesaurus xmlns:th="http://marklogic.com/xdmp/thesaurus">'
+'  <th:entry><th:term>dog</th:term>'
+'     <th:synonym><th:term>canine</th:term></th:synonym>'
+'  </th:entry>'
+'</th:thesaurus>')).root;
sc.elementDecl(th.xpath("//th:entry", 
                        {th: "http://marklogic.com/xdmp/thesaurus"} ));
=>
{http://marklogic.com/xdmp/thesaurus}entry

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