You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Jon Schewe <jo...@honeywell.com> on 2003/11/13 16:38:03 UTC

bug with handling of keys in 2.5.0?

I'm rather stuck here and am wondering if I'm trying to do something
invalid or there's a bug in Xerces.  This schema and instance document
validate with xsdvalidator, but not with Xerces (2.5.0).  Below are the
test instance and schema documents.  I'm using the xerces sample
dom.GetElementsByTagName with arguments -v -s.  The problem appears to be
that xerces doesn't like it when the selector of a key contains a parent
element and it's child, like so:
<xs:selector xpath="./dome:Model|./dome:Model/dome:Entity"/>

Any help would be greatly appreciated.


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://dome.honeywell.com"
           xmlns="http://dome.honeywell.com"
	   xmlns:dome="http://dome.honeywell.com"
           elementFormDefault="qualified" >

  <xs:element name="DOME">
    <xs:complexType>
      <xs:sequence minOccurs="1" maxOccurs="unbounded">
        <xs:element name="Model" type="ModelType"/>
     </xs:sequence>
    </xs:complexType>
    <xs:key name="PK">
      <xs:annotation>
        <xs:documentation>
          All guids must be unique within this file
        </xs:documentation>
      </xs:annotation>
      <xs:selector xpath="./dome:Model|./dome:Model/dome:Entity"/>
      <xs:field xpath="@guid"/>
    </xs:key>
  </xs:element>

  <xs:simpleType name="guidType">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:complexType name="UniqueObjectType">
    <xs:attribute name="guid" type="guidType" use="required"/>
  </xs:complexType>

  <xs:complexType name="EntityType">
    <xs:complexContent>
      <xs:extension base="UniqueObjectType" />
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="ModelType">
    <xs:complexContent>
      <xs:extension base="UniqueObjectType">
        <xs:sequence>
          <xs:element name="Entity" type="EntityType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<DOME xmlns="http://dome.honeywell.com"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://dome.honeywell.com test.xsd">
  <Model guid="1">
    <Entity guid="1"/>
  </Model>
</DOME>


-- 
Your mouse has moved. 
Windows must restart for change to take effect.
Reboot now? [OK]
*My views may not represent those of my employers

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org