Contains extensions or restrictions on a <complexType> element with character data or a <simpleType> element as content and contains no elements.
<simpleContent
id = ID
{any attributes with non-schema Namespace}…>
Content: (annotation?, (restriction | extension))
</simpleContent>
id value must be of type ID and be unique within the document containing this element.
Optional.
| Number of occurrences | One time |
| Parent elements | complexType |
| Contents | Optional annotation
Required One and only one of the following elements: restriction (simpleContent), or extension (simpleContent). |
The <simpleContent> element enables you to specify an element as containing a <simpleType> with no elements but enables you to restrict the value of the element's content or extend the element with attributes. For example, the following element declaration does not allow for adding attributes (such as sizing).
<xs:element name="shoeSize" type="xs:decimal"/>
Using the <simpleContent> element, the following element declaration contains a <complexType> element that defines the content of the element as a decimal type with a single attribute (sizing).
<xs:element name="shoeSize">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="sizing">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="US"/>
<xs:enumeration value="European"/>
<xs:enumeration value="UK"/>
<xs:enumeration value="Japan"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Simple content must be defined in one of the following ways.
| restriction element | Restricts the range of values for the element to a subset of those for inherited <simpleType>. |
| extension element | Extends the <simpleType> content of the element by adding attributes. |
The following example shows an element (generalPrice) declared using an anonymous <complexType> (one without a name) with its content defined as a decimal data type and with a currency attribute.
<xs:element name="generalPrice">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currency" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
XML Schema Reference (XSD) | XML Schema Elements
For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-simpleContent.
| This HTML Help has been published using the chm2web software. |