Loading TOC...

sc:element-decl

sc:element-decl(
   [$arg as item()]
) as element-decl()?

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

declare namespace th="http://marklogic.com/xdmp/thesaurus";
<decl>{
<th:thesaurus>
  <th:entry><th:term>dog</th:term>
     <th:synonym><th:term>canine</th:term></th:synonym>
  </th:entry>
</th:thesaurus>//th:entry/sc:element-decl()
}</decl>
  =>
<decl>
   <xs:element name="entry" type="th:entry" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:unique name="th:syn-term">
      <xs:selector>synonym</xs:selector>
      <xs:field xpath="term"/>
    </xs:unique>
  </xs:element></decl>

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