  | |  Re: schema validation : choice with min/maxOccurs in group not allow
? | Re: schema validation : choice with min/maxOccurs in group not allow
? 2003-05-23 - By K. Venugopal
Hi,
Code says :
// Neither minOccurs nor maxOccurs may be specified // for the child of a model group definition. may be one of the developers can help you by pointing to the spec.
you could use this until then .
<xs:group name="myGroup"> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="one" type="xs:string" /> <xs:element name="two" type="xs:string" /> </xs:choice> </xs:sequence> </xs:group>
Thanks venu
Gildas Guillemot wrote:
> hi, > > I have a problem of XML schema validation with Xerces 2.4.0. it seems > that the inclusion of an element 'choice' with the attributs minOccurs > and/or maxOccurs into a element 'group' was not allow by xerces. > Whereas it validates with XMLSpy and some exemples are built this way > in specifications. > > Here's an example to see my problem : > > The XML schema: > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified" attributeFormDefault="unqualified"> > <xs:element name="Fiche"> > <xs:complexType> > <xs:sequence> > <xs:group ref="myGroup"/> > </xs:complexType> > </xs:element> > <xs:group name="myGroup"> > <xs:choice minOccurs="0" maxOccurs="unbounded"> > <xs:element name="one" type="xs:string" minOccurs="0"/> > <xs:element name="two"type="xs:string" minOccurs="0"/> > </xs:choice> > </xs:group> > </xs:schema>
or
> <xs:group name="myGroup"> > <!--xs:choice minOccurs="0" maxOccurs="unbounded"--> > <xs:sequence> > <xs:element name="one" type="xs:string" minOccurs="0" > maxOccurs="unbounded"/> > <xs:element name="two" minOccurs="0" maxOccurs="unbounded"/> > </xs:sequence> > </xs:group>
Thanks venu
> > > The XML file : > > <?xml version="1.0" encoding="UTF-8"?> > <Fiche xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="test.xsd"> > <one>blabla</one> > <one>blabla bla</one> > <two>bla</two> > </Fiche> > > My command line : > java -cp > xercesImpl.jar;xercesSamples.jar;xml-apis.jar;xmlParserAPIs.jar > sax.Counter -s test.xml > > and the result : > [Error] test.xsd:11:27: s4s-att-not-allowed: Attribute 'minOccurs' > cannot appear in element 'choice'. > [Error] test.xsd:11:27: s4s-att-not-allowed: Attribute 'maxOccurs' > cannot appear in element 'choice'. > > > Best regards >
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|
 |