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

Inheritance and Identity-constraint

  • From: Faroukh Fekravar <fekravar@a...>
  • To: XML-DEV Discussion List <xml-dev@l...>
  • Date: Mon, 19 Feb 2001 15:58:15 -0600

xsd element inheritance

Hi folks,

I have two questions regarding Identity-constraint which give me
hard time!

1) in the example below the element "Item1" can be substituted by
element
"Item2". I have defined a key at the root (Project) level with
a xpath to 'Item1".
If I substitute "Item1" by "Item2" in my instance document,
is the key valid for "Item2" too?

<xsd:element name="Project">
 <xsd:complexType>
  <xsd:sequence>
  <xsd:element ref="Item1" maxOccurs="unbounded"/>
  </xsd:sequence>
 </xsd:complexType>

  <key name="Item1Key">
   <selector xpath="Item"/>
   <field xpath="@Id"/>
  </key>
</xsd:element>

<element name="Item1" type="Item1Type" />

 <complexType name="Item1Type" >
  <sequence>
   <element name="Id" type="string" minOccurs="1" maxOccurs="1"/>
  </sequence>
 </complexType>

<element name="Item2" type="Item2Type" substitutionGroup="Item1" />

 <complexType name="Item2Type" >
 <complexContent>
  <extension base= "Item1Type">
  <sequence>
   <element name="Name" type="string" minOccurs="0" maxOccurs="1"/>
  </sequence>
  </extension>
 </complexContent>
 </complexType>

2) I understand that the Identity-constraint is valid within a defined
scope. Is there anyway to
define the key in the example above within the "Item1" element but
declare somehow that
the scope is the whole document (something like this:)

<element name="Item1" type="Item1Type" >
  <key name="Item1Key">
   <selector xpath="Project/Item"/>
   <field xpath="@Id"/>
  </key>
</element>

<xsd:element name="Project">
<xsd:complexType>
 <xsd:sequence>
 <xsd:element ref="Item1" maxOccurs="unbounded"/>
 </xsd:sequence>
</xsd:complexType>
</xsd:element>

Thanks in advance,
Faroukh


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.