Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Problem defining Schema [Thread Next] RE: Problem defining SchemaTo: NULL Date: 3/30/2009 12:37:00 PM Hi Rahul,
Does the following schema work for you?
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://test.xsd"
targetNamespace="http://test.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:element name="X" type="X"/>
<xsd:complexType name="X">
<xsd:sequence>
<xsd:element name="A" type="TypeA" minOccurs="0" maxOccurs="unbounded"/>
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element name="B" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="A" type="TypeA" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TypeA">
</xsd:complexType>
</xsd:schema>
Regards,
Shuhai
"Rahul" wrote:
> Hi,
>
> I have to define a schema as below but this is not valid according to schema
> rules.
>
> It violates the followign rule because I have element B as minOccurs = 0. It
> is fine if I make B as MinOccurs = 1.
>
> http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#cos-nonambig
>
> How can I have define the schema in this situation so as to not violate the
> above rule.
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://test.xsd" targetNamespace="http://test.xsd"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>
> <xsd:element name="X" type="X"/>
>
> <xsd:complexType name="X">
>
> <xsd:sequence>
>
> <xsd:element name="A" type="TypeA" minOccurs="0" maxOccurs="unbounded"/>
>
> <xsd:element name="B" type="xsd:string" minOccurs="0" maxOccurs="1"/>
>
> <xsd:element name="A" type="TypeA" minOccurs="0" maxOccurs="unbounded"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> <xsd:complexType name="TypeA">
>
> </xsd:complexType>
>
> </xsd:schema>
>
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
