|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Best Practice for this problem?
I have recently been asked to look at a schema, of which this is a part: <xsd:choice> <xsd:annotation> <xsd:documentation>At least one of Town, County and Locality</xsd:documentation> </xsd:annotation> <xsd:choice> <xsd:element name="Town" type="bs7666:TownType"/> <xsd:element name="Locality" type="bs7666:LocalityType"/> <xsd:element name="County" type="bs7666:CountyType"/> </xsd:choice> <xsd:sequence> <xsd:element name="Town" type="bs7666:TownType"/> <xsd:element name="Locality" type="bs7666:LocalityType"/> </xsd:sequence> <xsd:sequence> <xsd:element name="Town" type="bs7666:TownType"/> <xsd:element name="County" type="bs7666:CountyType"/> </xsd:sequence> <xsd:sequence> <xsd:element name="Locality" type="bs7666:LocalityType"/> <xsd:element name="County" type="bs7666:CountyType"/> </xsd:sequence> <xsd:sequence> <xsd:element name="Town" type="bs7666:TownType"/> <xsd:element name="Locality" type="bs7666:LocalityType"/> <xsd:element name="County" type="bs7666:CountyType"/> </xsd:sequence> </xsd:choice> The intention is clear - at least one of the three elements <Town>, <Locality>, <County>, but each must not appear more than once. I believe the format to be non-compliant with XML Schema since each of the three elements has multiple definitions within the same scope. XML Authority 2.1 agrees with me, XML Spy 3.5 does not. If I am right, there are two choices: 1. Define the three elements globally, then reference them as required. This loses the benefit of a local definition within the complex data type. 2. Define the elements as at the start of the example: <xsd:choice> <xsd:element name="Town" type="bs7666:TownType"/> <xsd:element name="Locality" type="bs7666:LocalityType"/> <xsd:element name="County" type="bs7666:CountyType"/> </xsd:choice> Then access by reference from there. For example: <xsd:sequence> <xsd:element ref="Town"/> <xsd:element ref="Locality"/> </xsd:sequence> I have never seen an example that uses "ref=" pointing to a locally scoped definition. Is this allowed? Any thoughts? Regards Paul Spencer
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








