E
edkawas
Hi,
Can the following be done?
I have some elements, that can have other sub elements with mixed
content.
The sub elements can either be restricted via min=1, max=1 or min=1
max=unbounded.
The order of the sub elements is not important and will vary.
Examples of an instance are,
<foo>
<boo>bob is my uncle</boo>
<soo>64<soo>
<foo>
or
<foo>
<soo>64<soo>
<boo>bob is my uncle</boo>
<foo>
or
<foo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<boo>bob is my uncle</boo>
<foo>
or
<foo>
<soo>64<soo>
<boo>bob is my uncle</boo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<foo>
Notice how boo is bound with the restriction min=max=1
and soo is >=1!
I am pretty new to schemas, but I do believe that the only way to do
this is something like the following:
....
<xsd:element name="soo" type="xsd:int" />
<xsd:element name="boo" type="xsd:string" />
<xsd:element name="foo">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element ref="soo" minOccurs="1" maxOccurs="unbounded" />
<xsd:element ref="boo" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
<xsd:sequence>
<xsd:element ref="boo" minOccurs="1" maxOccurs="1" />
<xsd:element ref="soo" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
</xsd:element>
....
Do i really have to enumerate through all of the possibilities? I hope
not, because when the number of children of foo grows (let the number
of children = n), the possibilities would be n! There has to be
something that i am missing.
Any ideas?
Thanks,
Eddie
Can the following be done?
I have some elements, that can have other sub elements with mixed
content.
The sub elements can either be restricted via min=1, max=1 or min=1
max=unbounded.
The order of the sub elements is not important and will vary.
Examples of an instance are,
<foo>
<boo>bob is my uncle</boo>
<soo>64<soo>
<foo>
or
<foo>
<soo>64<soo>
<boo>bob is my uncle</boo>
<foo>
or
<foo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<boo>bob is my uncle</boo>
<foo>
or
<foo>
<soo>64<soo>
<boo>bob is my uncle</boo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<soo>64<soo>
<foo>
Notice how boo is bound with the restriction min=max=1
and soo is >=1!
I am pretty new to schemas, but I do believe that the only way to do
this is something like the following:
....
<xsd:element name="soo" type="xsd:int" />
<xsd:element name="boo" type="xsd:string" />
<xsd:element name="foo">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element ref="soo" minOccurs="1" maxOccurs="unbounded" />
<xsd:element ref="boo" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
<xsd:sequence>
<xsd:element ref="boo" minOccurs="1" maxOccurs="1" />
<xsd:element ref="soo" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
</xsd:element>
....
Do i really have to enumerate through all of the possibilities? I hope
not, because when the number of children of foo grows (let the number
of children = n), the possibilities would be n! There has to be
something that i am missing.
Any ideas?
Thanks,
Eddie