XML Schema simpleContent element
Definition and usage
The simpleContent element contains an extension or restriction of the complexType element (which is content with character data or simpleType elements) and does not contain any elements.
Element information
Occurrence | Once |
Parent element | complexType |
Content |
Optional option — annotation Mandatory option — One and only one of the following elements: restriction (simpleContent) or extension (simpleContent). |
Syntax
<simpleContent id=ID any attributes > (annotation?,(restriction|extension)) </simpleContent>
(? The symbol indicates that the element can occur zero or one times within the simpleContent element.)
Attribute | Description |
---|---|
id | Optional. Specifies the unique ID of the element. |
any attributes | Optional. Specifies any other attributes with a non-schema namespace. |
Instance
Example 1
This is an XML element that contains 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 includes 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>