Altova Mailing List Archives>Archive Index >xml-dev Archive Home >Recent entries >Thread Prev - XML Schema and the Unique Particle Attribution (UPA) rule >Thread Next - RE: [xml-dev] XML Schema and the Unique Particle Attribution (UPA) rule RE: [xml-dev] XML Schema and the Unique Particle Attribution (UPA) ruleTo: 'Azariah Jeyakumar' <ajeyakumar@----.--->, xml-dev@-----.---.--- Date: 8/10/2007 9:33:00 PM This is a feature often requested in XML Schema called "cooccurrence constraints". It can't be done in XML Schema 1.0, unless you are prepared to change your <type> element into an xsi:type attribute. It will be possible in XML Schema 1.1, but that's still in the future. Michael Kay http://www.saxonica.com/ From: Azariah Jeyakumar [mailto:ajeyakumar@t...] Sent: 10 August 2007 22:22 To: xml-dev@l... Subject: [xml-dev] XML Schema and the Unique Particle Attribution (UPA) rule Hi,<o:p></o:p> <o:p> </o:p> I would like to create an XML Schema for the content model like:<o:p></o:p> <o:p> </o:p> <M><o:p></o:p> <type>type1</type><o:p></o:p> <… several elements specific to type1 …><o:p></o:p> </M><o:p></o:p> <o:p> </o:p> <M><o:p></o:p> <type>type2</type><o:p></o:p> <… several elements specific to type2 …><o:p></o:p> </M><o:p></o:p> <o:p> </o:p> Etc<o:p></o:p> <o:p> </o:p> I was playing with a XML Schema like:<o:p></o:p> <o:p> </o:p> <xs:complexType name="upa_test"><o:p></o:p> <xs:choice><o:p></o:p> <xs:sequence><o:p></o:p> <xs:element name="type" type="xs:string" fixed="type1" /><o:p></o:p> <xs:element name="B" type="xs:string"/><o:p></o:p> </xs:sequence><o:p></o:p> <xs:sequence><o:p></o:p> <xs:element name="type" type="xs:string" fixed="type2" /><o:p></o:p> <xs:element name="C" type="xs:string"/><o:p></o:p> </xs:sequence><o:p></o:p> </xs:choice><o:p></o:p> </xs:complexType><o:p></o:p> <o:p> </o:p> But the processor I am using rejects this Schema saying it violates the UPA rule. Shouldn’t the processor be able to uniquely determine the particle based on the element’s type and/or value? Can someone suggest an alternate XML Schema that would not violate the UPA rule?<o:p></o:p> <o:p> </o:p> Changing the content model to introduce an intermediate level for <type1>, <type2>, etc would work, but I can’t make this change as it would break backward compatibility.<o:p></o:p> <o:p> </o:p> Thanks<o:p></o:p> Azariah<o:p></o:p> <o:p> </o:p> | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
