- From: Priscilla Walmsley <priscilla@walmsley.com>
- Date: Fri, 15 Nov 2002 14:52:12 -0500
- To: "'Jeremy Vander Kam'" <jvanderkam@mail.arc.nasa.gov>, <xmlschema-dev@w3.org>
Hi Jeremy, Your content model is ambiguous. Try this: <xsd:complexType name="AEEAggregation"> <xsd:sequence> <xsd:element name="Coefficients" type="AEEGroup"/> <xsd:choice> <xsd:sequence> ...the rest of the first sequence... </xsd:sequence> <xsd:sequence> ...the rest of the second sequence... </xsd:sequence> </xsd:choice> </xsd:sequence> <xsd:attribute name="name" use="required"/> </xsd:complexType> Hope that helps, Priscilla ----------------------------------------------------- Priscilla Walmsley priscilla@walmsley.com Author, Definitive XML Schema (Prentice Hall PTR) ----------------------------------------------------- > -----Original Message----- > From: xmlschema-dev-request@w3.org > [mailto:xmlschema-dev-request@w3.org] On Behalf Of Jeremy Vander Kam > Sent: Friday, November 15, 2002 11:27 AM > To: xmlschema-dev@w3.org > Subject: xerces 2.2.0 DOM.Counter with validation error - > xsd:choice and group references > > > > Hi, > > I have the following schema: > > <xsd:complexType name="AEEAggregation"> > <xsd:choice> > <xsd:sequence> > <xsd:element name="Coefficients" > type="AEEGroup"/> > <xsd:element name="WeightEquation" > type="AEEEquation"/> > <xsd:element name="Weight" > type="AEEDouble"/> > <xsd:element name="WeightUpperLimit" > type="AEEDouble" minOccurs="0"/> > <xsd:element name="WeightLowerLimit" > type="AEEDouble" minOccurs="0"/> > <xsd:element name="ReferenceWeight" > type="AEEDouble" minOccurs="0"/> > <xsd:element name="CenterOfGravity" > type="AEEArray" minOccurs="0"/> > <xsd:element name="MomentOfInertia" > type="AEEArray" minOccurs="0"/> > <xsd:element name="Mass" > type="AEEDouble" > minOccurs="0"/> > <xsd:element name="MERReference" > type="AEESimpleVariable" minOccurs="0"/> > </xsd:sequence> > <xsd:sequence> > <xsd:element name="Coefficients" > type="AEEGroup"/> > <xsd:element name="Equation" > type="AEEEquation"/> > <xsd:element name="EquationValue" > type="AEEString"/> > <xsd:element name="Reference" > type="AEESimpleVariable" minOccurs="0"/> > </xsd:sequence> > </xsd:choice> > <xsd:attribute name="name" use="required"/> > </xsd:complexType> > > And the following XML where Aggregation is of the type > AEEAggregation from > above: > > <Aggregation name="massRatio"> > <Coefficients> > <gross>string</gross> > <propellant>string</propellant> > </Coefficients> > <Equation>gross/(gross-propellant)</Equation> > <EquationValue>9999</EquationValue> > </Aggregation> > > I get the following validation error: > > [Error] AEE_data_021115.xml:14440:129: > cvc-complex-type.2.4.a: Invalid > content starting with element 'Equation'. The content must match > '((("":Coefficients),("":WeightEquation),("":Weight),("":Weigh > tUpperLimit){0-1},("":WeightLowerLimit){0-1},("":ReferenceWeig > ht){0-1},("":CenterOfGravity){0-1},("":MomentOfInertia){0-1},( > "":Mass){0-1},("":MERReference){0-1})|(("":Coefficients),("":E > quation),("":EquationValue),("":Reference){0-1}))'. > > Now, it seems to me that my XML is valid based on the choice > between the > two sequences. In fact, if I reverse the order of the > sequences in the > schema document, I get the same error for all my Aggregation > elements that > implement the second sequence in the xsd:choice element. This > behavior > seems like a bug in the validation to me. > > The validation done in XMLSpy (I don't know which parser they > use) accepts > things just fine with the exact same schema and xml. > > Has anyone seen this type of behavior? Have any suggestions? > > Thanks > -Jeremy > >
Received on Friday, 15 November 2002 15:04:20 UTC