identity constraint with "xsd:any" and self-embedded element

Hi, 

 

I have questions on identity constraint validation when it meets with
"xsd:any" and self-embedded elements instance file. Could you please
give me some help? Thanks!

 

1.     When xsd:any is validated with the actual element "t" in XML
instance file, here t has defined an identity constraint:

a)     If processContents is "strict", "lax", or "skip", do we need to
check its identity constraint by collecting target/qualified nodes among
his child-nodes via selector and fields, with "t" as context node?

b)     If above question is "yes", then do we need to check this node
itself (include attributes), namely the element "t" itself? 

 

2.     When the instance file where the identity constraint scoping
element (where identity constraint is defined) becomes self-embedded.
Below is the example. Why XERCES schema validator reports key "tableu3"
and "tableu1" have multiple fields? It seems to me that there are 4
target nodes (element "myNS:row") and each having unique "." as its key
sequence. 

 

Instance file

<?xml version="1.0"?>

<myNS:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:myNS="myNS.tempuri.org">

   <myNS:t myNS:col="3">    

      <myNS:row>1</myNS:row>

      <myNS:row>3</myNS:row>

      <myNS:t myNS:col="3">

          <myNS:row>1</myNS:row>

          <myNS:row>3</myNS:row>

      </myNS:t>

   </myNS:t>

</myNS:root>

 

Schema file

<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="qualified"
targetNamespace="myNS.tempuri.org" xmlns:myNS="myNS.tempuri.org"
xmlns="myNS.tempuri.org">

 

   <xsd:complexType name="mytype">

      <xsd:sequence>

          <xsd:any  minOccurs="0" maxOccurs="unbounded"/>

      </xsd:sequence>

      <xsd:attribute name="col" type="xsd:string"/>

   </xsd:complexType>

          

   <xsd:element name="root">

      <xsd:complexType>

          <xsd:sequence>

             <xsd:element ref="t" maxOccurs="unbounded"/>

          </xsd:sequence>

      </xsd:complexType>           

   </xsd:element>

   

   <xsd:element name="row" type="xsd:string"/>

   <xsd:element name="t" type="mytype">     

      <xsd:key id="foo1" name="tableu1">

          <xsd:selector xpath=".//myNS:t/myNS:row"/>

          <xsd:field xpath="."/>

      </xsd:key>

      <xsd:key id="foo2" name="tableu2">

          <xsd:selector xpath=".//myNS:t"/>

          <xsd:field xpath="@myNS:col"/>

      </xsd:key>

      <xsd:key id="foo3" name="tableu3">

          <xsd:selector xpath=".//myNS:row"/>

          <xsd:field xpath="."/>

      </xsd:key>

   </xsd:element>

</xsd:schema>

 

XERCES schema validator reports

[Error] keyselfembed.xml:6:24: cvc-identity-constraint.4.2.2: Duplicate
key value [3] declared for identity constraint "tableu2" of element "t".

[Error] keyselfembed.xml:7:26: cvc-identity-constraint.3: Field "." of
identity constraint "tableu3" matches more than one value within the
scope of its selector; fields must match unique values.

[Error] keyselfembed.xml:7:26: cvc-identity-constraint.4.2.1.a: Element
"t" has no value for the key "tableu3".

[Error] keyselfembed.xml:8:26: cvc-identity-constraint.3: Field "." of
identity constraint "tableu3" matches more than one value within the
scope of its selector; fields must match unique values.

[Error] keyselfembed.xml:8:26: cvc-identity-constraint.4.2.1.a: Element
"t" has no value for the key "tableu3".

 

"I hear and I forget, I see and I remember, I do and I understand" --
Quoted by Yongnian

Le, Yongnian

ICSC Compiler Lab

8821-6253

 

 

Received on Sunday, 18 March 2007 20:44:48 UTC