XML Schema simpleContentElement


XML Schema 参考手册Complete XML Schema Reference Manual

Definition and Usage

The simpleContent element contains extensions or restrictions on a complexType element (which has character data or a simpleType element as its content) and does not contain any elements.

Element Information

  • Parent element: complexType

Syntax

<simpleContent
id=ID
any attributes
>

(annotation?,(restriction|extension))

</simpleContent>

(The ? symbol declares that the element may occur zero or one time within the simpleContent element.)

Attributes Description
id Optional. Specifies the unique ID of this element.
any attributes Optional. Specifies any other attribute with a non-schema namespace.

Example 1

This is an XML element containing only text (<shoesize>):

<shoesize country="france">35</shoesize>

The following example declares a complex type "shoesize", whose content is defined as an integer data type, and which has a country attribute:

<xs:element name="shoesize">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:integer">
        <xs:attribute name="country" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>


XML Schema 参考手册Complete XML Schema Reference Manual Other extensions