- From: Lemmin, Harald <Harald.Lemmin@softwareag.com>
- Date: Thu, 28 Aug 2003 09:32:17 +0200
- To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
- Message-ID: <DFF2AC9E3583D511A21F0008C7E6210606E34CE3@daemsg02.software-ag.de>
The violation of the Unique Particle Attribution rule I can explain to you: If the parser meets the "cdsOSId" element it has to be clear which of the choices is to be choosen for the validation of the next element. This is not the case here. What this "Duplicate element decl in the same scope" is about I cannot explain. But your schema can be simply rewritten to meet the expectations, its much shorter now: <xs:complexType> <xs:sequence> <xs:element name="cdsOSId" type="xs:unsignedLong"/> <xs:choice> <xs:element name="cdsOSName" type="xs:string" minOccurs="0"/> <xs:element name="cdsUId" type="xs:unsignedLong"/> </xs:choice> <xs:element name="provisioningData" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:any namespace="##any" processContents="lax" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> -----Original Message----- From: Xuejun Li (SH/RDC) [mailto:xuejun.li@ericsson.com] Sent: Donnerstag, 28. August 2003 09:22 To: 'xmlschema-dev@w3.org' Subject: The same element in two choice segments Hi schema experts, I want to define a schema like the following: <xs:schema targetNamespace="http://schemas.ericsson.com/snf/cpm1.0/" xmlns:cai3g="http://schemas.ericsson.com/cai3g1.0/2003/05/30/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cpm="http://schemas.ericsson.com/snf/cpm1.0/" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="OfferedService" > <xs:complexType> <xs:choice> <xs:sequence> <xs:element name="cdsOSId" type="xs:unsignedLong"/> <xs:element name="cdsOSName" type="xs:string" minOccurs="0"/> <xs:element name="provisioningData" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:any namespace="##any" processContents="lax" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:sequence> <xs:element name="cdsOSId" type="xs:unsignedLong"/> <xs:element name="cdsUId" type="xs:unsignedLong"/> <xs:element name="provisioningData" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:any namespace="##any" processContents="lax" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:choice> <xs:attribute name="cdsOSId" type="xs:unsignedLong" use="required"/> </xs:complexType> </xs:element> </xs:schema> What I did was, there is an element "cdsOSId" defined in two "xs:sequence" inside a "xs:choice". The same with another element "provisioningData". Then I used the xerces parser to parse the following document: <OfferedService cdsOSId="123" xmlns="http://schemas.ericsson.com/snf/cpm1.0/" xmlns:cai3g="http://schemas.ericsson.com/cai3g1.0/2003/05/30/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.ericsson.com/snf/cpm1.0/ ./OfferedService.xsd"> <cdsOSId>123</cdsOSId> <cdsOSName>cdsOSName</cdsOSName> <provisioningData><a>provisioningDataXML</a></provisioningData> </OfferedService> And I got two errors. One is "Duplicate element decl in the same scope: provisioningData", the error is reported on the schema. The other is " 'cdsOSId' and 'cdsOSId' violate the Unique Particle Attribution rule", the error is reported on the XML document. I wonder is it allowed to define the same element in two choice segments? Why provisioningData is refused during the schema parsing while cdsOSId is found wrong on the XML document? Thanks Li Xuejun
Received on Thursday, 28 August 2003 03:32:30 UTC