Hi - I am having troubles with the use of the 'unique' element.
An example of the manner in which I am attempting to use it is
listed below. The SAX2Count example run with the -f and -p does
not report an error when the eid attributes are not unique.

If I get rid of the targetNamespace and make the corresponding
changes to the sample schema and document, then 'unique' works as
I would expect. Any idea where I am going wrong? I tried to read
through the appropriate sections of the spec, but I don't see any
obvious problems. I seem to be running into similar problems with
the use of key/keyref.

--- SCHEMA ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<schema targetNamespace="http://www.example.com/Per";
        xmlns='http://www.w3.org/2001/XMLSchema'
        xmlns:per="http://www.example.com/Per";>

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

    <unique name="unique1">
      <selector xpath="per:person"/>
      <field xpath="@eid"/>
    </unique>
  </element>

  <element name="person">
    <complexType>
      <attribute name="eid" type="string" use="required"/>
      <attribute name="name" type="string" use="required"/>
    </complexType>
  </element>
</schema>
---- SAMPLE DOC ---
<?xml version="1.0" encoding="ISO-8859-1"?>

<personnel xmlns="http://www.example.com/Per";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:schemaLocation="http://www.example.com/Per
tns.xsd">
  <person eid="1" name="Bill"/>
  <person eid="2" name="Paul"/>
  <person eid="4" name="Joe"/>
  <person eid="4" name="Paul"/>
</personnel>


Regards,

Jim


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

Reply via email to