Xerces and QName resolution

I posted this to Xerces directly as well-- I just want to make sure I am
understanding QName resolution properly:

Is Xerces-J 1.4 enforcing the QName resolution constraint? [1]  In the
sample personal.xsd (at end of mail) I believe there is an error that is not
reported.  I don't think the ref's to the schema components should be
resolved as they should be in the no-namespace (because there is no
targetNamespace) and they are actually in th schema namespace because they
are qualified.  I could be wrong about that.  Nevertheless, I added a
targetNamespace to personal.xsd and referred to it in personal-schema.xml to
ensure that there is very clearly an error-- but Xerces didn't catch it (IBM
Schema Quality Checker reports it as an error):

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns='http://www.w3.org/2001/XMLSchema'
targetNamespace="http://foo">

 <element name="personnel">
  <complexType>
   <sequence>
     <element ref="person" minOccurs='1' maxOccurs='unbounded'/>
   </sequence>
  </complexType>

...

 <element name="person">
...
 </element>


Above the peronal element contains a person element which is declared by
reference.  The ref to the person element should raise an error as it cannot
be resolved because the ref is unqualified.

[1] http://www.w3.org/TR/xmlschema-1/#src-resolve

Thanks,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting

personal.xsd
=========
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns='http://www.w3.org/2001/XMLSchema'>

 <element name="personnel">
  <complexType>
   <sequence>
     <element ref="person" minOccurs='1' maxOccurs='unbounded'/>
   </sequence>
  </complexType>

  <unique name="unique1">
   <selector xpath="person"/>
   <field xpath="@name"/>
  </unique>
  <key name='empid'>
   <selector xpath="person"/>
   <field xpath="@id"/>
  </key>
  <!--
  <keyref name="keyref1" refer='empid'>
   <selector xpath="person"/>
   <field xpath="link/@manager"/>
  </keyref>
  -->

 </element>

 <element name="person">
  <complexType>
   <sequence>
     <element ref="name"/>
     <element ref="email" minOccurs='0' maxOccurs='unbounded'/>
     <element ref="url"   minOccurs='0' maxOccurs='unbounded'/>
     <element ref="link"  minOccurs='0' maxOccurs='1'/>
   </sequence>
   <attribute name="id"  type="ID" use='required'/>
   <attribute name="note" type="string"/>
   <attribute name="contr" default="false">
    <simpleType>
     <restriction base = "string">
       <enumeration value="true"/>
       <enumeration value="false"/>
     </restriction>
    </simpleType>
   </attribute>
   <attribute name="salary" type="integer"/>
  </complexType>
 </element>

 <element name="name">
  <complexType>
   <all>
    <element ref="family"/>
    <element ref="given"/>
   </all>
  </complexType>
 </element>

 <element name="family" type='string'/>

 <element name="given" type='string'/>

 <element name="email" type='string'/>

 <element name="url">
  <complexType>
   <attribute name="href" type="string" default="http://"/>
  </complexType>
 </element>

 <element name="link">
  <complexType>
   <attribute name="manager" type="IDREF"/>
   <attribute name="subordinates" type="IDREFS"/>
  </complexType>
 </element>

 <notation name='gif' public='-//APP/Photoshop/4.0' system='photoshop.exe'/>

</schema>

Received on Tuesday, 19 June 2001 02:02:19 UTC