Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xml-dev] XML Schema and the Unique Particle Attribution (UPA) rule

From: Michael Kay <mike@--------.--->
To: '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>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent