[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML Schema and the Unique Particle Attribution (UPA) rule

  • From: Michael Kay <mike@s...>
  • To: 'Azariah Jeyakumar' <ajeyakumar@t...>, xml-dev@l...
  • Date: Fri, 10 Aug 2007 22:31:45 +0100

RE:  XML Schema and the Unique Particle Attribution (UPA) rule
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 Schema and the Unique Particle Attribution (UPA) rule

Hi,

 

I would like to create an XML Schema for the content model like:

 

<M>

  <type>type1</type>

  <… several elements specific to type1 …>

</M>

 

<M>

  <type>type2</type>

  <… several elements specific to type2 …>

</M>

 

Etc

 

I was playing with a XML Schema like:

 

  <xs:complexType name="upa_test">

    <xs:choice>

      <xs:sequence>

        <xs:element name="type" type="xs:string" fixed="type1" />

        <xs:element name="B" type="xs:string"/>

      </xs:sequence>

      <xs:sequence>

        <xs:element name="type" type="xs:string" fixed="type2" />

        <xs:element name="C" type="xs:string"/>

      </xs:sequence>

    </xs:choice>

  </xs:complexType>

 

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?

 

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.

 

Thanks

Azariah

 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.