S
Sven
Hi,
I want to define a XML schema for something similar to the following
XML data:
<TextItem>
<Name>Temperature</Name>
<Content>27°C</Content>
</TextItem>
<TextItem>
<Content>cloudy</Content>
<Name>Sky</Name>
</TextItem>
With a variable sequence order for Name and Content I can define this
as:
<xs:complexType name="TextItemType">
<xs:sequence maxOccurs="unbounded" minOccurs="1">
<xs:choice>
<xs:element name="Name" type="xs:string" />
<xs:element name="Content" type="xs:string" />
</xs:choice>
</xs:sequence>
</xs:complexType>
As I want define different Item types I define a base type Item and
derive the special content types:
<xs:complexType name="ItemType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="1" name="Name"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="TextItemType">
<xs:complexContent>
<xs:extension base="ItemType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="1" name="Content"
type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
But with this schema, the order of "Name" and "Content" is relevant.
Is there a way to define this in a way that this order is variable?
Thanks,
Sven Bauhan
I want to define a XML schema for something similar to the following
XML data:
<TextItem>
<Name>Temperature</Name>
<Content>27°C</Content>
</TextItem>
<TextItem>
<Content>cloudy</Content>
<Name>Sky</Name>
</TextItem>
With a variable sequence order for Name and Content I can define this
as:
<xs:complexType name="TextItemType">
<xs:sequence maxOccurs="unbounded" minOccurs="1">
<xs:choice>
<xs:element name="Name" type="xs:string" />
<xs:element name="Content" type="xs:string" />
</xs:choice>
</xs:sequence>
</xs:complexType>
As I want define different Item types I define a base type Item and
derive the special content types:
<xs:complexType name="ItemType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="1" name="Name"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="TextItemType">
<xs:complexContent>
<xs:extension base="ItemType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="1" name="Content"
type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
But with this schema, the order of "Name" and "Content" is relevant.
Is there a way to define this in a way that this order is variable?
Thanks,
Sven Bauhan