XSD Elements Only
An "elements-only" complex type contains an element that contains only other elements.
Complex Types Containing Elements Only
An XML element, "person", that contains only other elements:
<person>
<firstname>John</firstname>
<lastname>Smith</lastname>
</person> |
You can define the "person" element in a schema, like this:
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element> |
Notice the <xs:sequence> tag. It means that the elements defined ("firstname"
and "lastname") must appear in that order inside a "person" element.
Or you can give the complexType element a name, and let the "person" element
have a type attribute that refers to the name of the complexType (if you use
this method, several elements can refer to the same complex type):
<xs:element name="person" type="persontype"/>
<xs:complexType name="persontype">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType> |
Click here to design a Stunning Flash Website for Free
Wix is a revolutionary web design tool that provides anyone with the possibility to create professional and beautiful websites for free.
With e-commerce features, search engine visibility and many more professional tools, Wix is the ultimate solution for creating a spectacular site while saving tons of money.
|