XML Schema: Coding requirements for element type declarations

Structural and domain vocabulary modules have the same XSD coding requirements for element type declarations.

Element definitions

A structural or domain vocabulary module must contain a declaration for each specialized element type named by the module. While the XSD standard allows content models to refer to undeclared element types, all element types named in content models within a vocabulary module must have an <xs:element> declaration, either in the vocabulary module, in a base module from which the vocabulary module is specialized, or in a required domain module.

Domain modules consist of a single XSD document. Structural modules consist of two modules; one module contains all element name groups, and the other contains all other declarations for the module.

For each element type that is declared in the vocabulary module, the following set of groups and declarations must be used to define the content model and attributes for the element type. These groups are typically placed together within the module for clarity.

For example, the following set of declarations shows each of the required groups and definitions for the specialized <codeph> element.
<xs:group name="codeph">
      <xs:element ref="codeph"/>

<xs:group name="codeph.content">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:group ref="basic.ph.notm"/>
      <xs:group ref="data.elements.incl"/>
      <xs:group ref="draft-comment"/>
      <xs:group ref="foreign.unknown.incl"/>
      <xs:group ref="required-cleanup"/>

<xs:attributeGroup name="codeph.attributes">
  <xs:attributeGroup ref="univ-atts"/>
  <xs:attribute name="outputclass" type="xs:string"/>
  <xs:attributeGroup ref="global-atts"/>

<xs:complexType name="codeph.class" mixed="true">
    <xs:group ref="codeph.content"/>
  <xs:attributeGroup ref="codeph.attributes"/>

<xs:element name="codeph">
    <xs:documentation> <!-- documentation for codeph --> </xs:documentation>
      <xs:extension base="codeph.class">
        <xs:attribute ref="class" default="+ topic/ph pr-d/codeph "/>

Return to main page.