XSD assertion with xsi types

sshanmug <[email protected]>
Newsgroups gmane.text.xml.xerces-j.user
Message-ID <[email protected]>
Another question on XSD 1.1 and assertions in the complex types. 
Use case: An abstract  complext type having another abstract complex type
element

 For example: 
 <xs:complexType name="abstract-comp-type" abstract="true">
  <xs:sequence>
  <xs:element type="xs:string" name="description" minOccurs="1"
maxOccurs="1" />
  <xs:element name="comp-id" type="xs:ID" minOccurs="1" />
   <xs:element ref="sub-abstract-type">
  </xs:complexType>
  
  <xs:element name="sub-abstract" type="sub-abstractType" />
  <xs:complexType name="sub-abstractType" abstract=true/>
  
 I have more than one complex types extending from abstract-comp-type and
individual complex types extending sub-abstractType

 <xs:complexType name="concrete-TypeA">
    <xs:complexContent>
     <xs:extension base="abstract-comp-type">
  <xs:sequence>
  <xs:element name="element1" type="xs:string" minOccurs="1" fixed="test"/>
  </xs:sequence>
  </xs:extension>
  </xs:complexContent>
  </xs:complexType>

  
<xs:complexType name="concrete-sub-TypeA">
  
  <xs:complexContent>
     <xs:extension base="sub-abstractType">
  </xs:extension>
  </xs:complexContent>
  </xs:complexType>
  
  
  
  <xs:complexType name="concrete-TypeB">
    <xs:complexContent>
     <xs:extension base="abstract-comp-type">
  <xs:sequence>
  <xs:element name="elemen2" type="xs:string" minOccurs="1" fixed="test"/>
  </xs:sequence>
  </xs:extension>
  </xs:complexContent>
  </xs:complexType>

  
<xs:complexType name="concrete-sub-TypeB">
  
  <xs:complexContent>
     <xs:extension base="sub-abstractType">
  </xs:extension>
  </xs:complexContent>
  </xs:complexType>

 I need to add validation , so that if the instance is of type
Concreate-TypeA, it should have concrete-sub-TypeA, and same with
Concrete-typeB and concrete-sub-TypeB
 
 I tried with the following assert element....But its not working. Can you 
help with the right syntax?
 <xs:assert test="(@xsi:type='Concreate-TypeA' and
root/sub-abstract/@xsi:type='concrete-sub-TypeA') or
 (@xsi:type='Concreate-TypeB' and
root/sub-abstract/@xsi:type='concrete-sub-TypeBA')"/>



--
View this message in context: http://apache-xml-project.6118.n7.nabble.com/XSD-assertion-with-xsi-types-tp41276.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.