OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inheritance and Identity-constraint




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