Hi John,

That's a bug.  Please file a report in bugzilla, attaching these
schema/instance documents.

If all you want to assert is really that "all guids must be unique", then
there is a workaround:  replace your selector's xpath with .//*.  This
produces the correct result on this file anyway.

Hope that helps,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  905-413-3519, T/L 969-3519
E-mail:  [EMAIL PROTECTED]




                                                                                
                                                       
                      Jon Schewe                                                
                                                       
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]     
                                             
                      well.com>                cc:                              
                                                       
                                               Subject:  problem with keys      
                                                       
                      11/07/2003 05:00                                          
                                                       
                      PM                                                        
                                                       
                      Please respond to                                         
                                                       
                      xerces-j-user                                             
                                                       
                                                                                
                                                       
                                                                                
                                                       



I'm rather stuck here and am wondering if I'm trying to do something
invalid or what.  This schema and instance document validate with xsv, but
not with Xerces (2.5.0).  Attached are the 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to