Hello Vadim,
Monday, April 09, 2001, 11:27:15 AM, you wrote:
> Hi,
> I need someone's help very much on XML Schema
> Having the following example :
> <header>
> <a/>
> <header>
> <body>
> <sub><a/>...</sub>
> </body>
> If it is possible to express in XML schema definition language that element
> <a/> may be omitted in <sub>, but _if_ it it is present in <header>, or
> element <a/> _must_ be present in <sub> if not
> present in <header>?
> Thanks in advance,
> Vadim Solonovich
Try this:
<element name="headerandbody1">
<sequence>
<element name="header" type="string minOccurs="1" maxOccurs="1">
<complexType>
<sequence>
<element ref="a" minOccurs="1" maxOccurs="1" />
</sequence>
</complexType>
</element>
<element name="body" minOccurs="1" maxOccurs="1">
<complexType>
<sequence>
<element ref="sub" minOccurs="1" maxOccurs="1" />
</sequence>
</complexType>
</element>
</sequence>
</complexType>
<element name="headerandbody2">
<sequence>
<element name="header" type="string minOccurs="1" maxOccurs="1"/>
<element name="body" minOccurs="1" maxOccurs="1">
<complexType>
<sequence>
<element ref="sub" minOccurs="1" maxOccurs="1">
<complexType>
<sequence>
<element ref="a" minOccurs="1" maxOccurs="1" />
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
<element name="headerandbody">
<complexType>
<choice>
<element href="headerandbody1" minOccurs="1" maxOccurs="1" />
<element href="headerandbody2" minOccurs="1" maxOccurs="1" />
</choice>
</compleyType>
</element>
It is not ideal but it should work. Namespaces and so you have to add
yourself.
--
Regards,
Birgit mailto:[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]