Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Schema issue [Thread Next] Re: Schema issueTo: NULL Date: 3/25/2009 4:06:00 PM Let me put my prolem in another way. <xsd:element name="X" type="X"/> <xsd:complexType name="X"> <xsd:sequence> <xsd:element name="A" type="MyType" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="B" type="xsd:string" minOccurs="0" maxOccurs="1"/> <xsd:element name="A" type="MyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="MyType"></xsd:complexType> </xsd:schema> Now how do I do this? "smadden" <stephen.madden@c...> wrote in message news:799408a3-af95-45a0-8a8e-8049c295284a@s...... On Mar 20, 9:45 am, "Rahul" <reach_aggar...@hotmail.com> 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="xsd:string" minOccurs="0" > maxOccurs="unbounded"/> > > <xsd:element name="B" type="xsd:string" minOccurs="0" maxOccurs="1"/> > > <xsd:element name="A" type="xsd:string" minOccurs="0" > maxOccurs="unbounded"/> > > </xsd:sequence> > > </xsd:complexType> > > </xsd:schema> > > Thanks > > Rahul The only problem I see is multiple definitions of an element (i.e., element 'A'). Rename the last element 'C' and you should be fine. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
