You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by ma...@kodak.com on 2002/08/26 22:20:18 UTC

xmlvalidator does not detect violations of uniqueness

From: Marvin M. Goodgame

I am running an xmlvalidator application that is built on the Xerces-2.0.2
release using org.apache.xerces.parsers.SAXParser class for parsing.  The
following features are set "true" on the parser:
      http://xml.org/sax/features/validation
      http://xml.org/sax/features/namespaces
      http://apache.org/xml/features/validation/schema
      http://apache.org/xml/features/validation/schema-full-checking

This xmlvalidator fails to report the violation of uniqueness for attribute
"b":
      <A
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://www.example.com/A"
            xsi:schemaLocation="http://www.example.com/A
                                file:/home/goodgame/tmp/A.xsd">
        <B b="1"/>
        <B b="2"/>
        <B b="1"/>
      </A>

as specified in the following schema:
      <xsd:schema
              targetNamespace="http://www.example.com/A"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns="http://www.example.com/A">

      <xsd:complexType name="AType">
        <xsd:sequence>
          <xsd:element ref="B" maxOccurs="unbounded"/>
        </xsd:sequence>
      </xsd:complexType>

      <xsd:complexType name="BType">
        <xsd:attribute name="b" type="xsd:positiveInteger" use="required"/>
      </xsd:complexType>

      <xsd:element name="A" type="AType">
        <xsd:unique name="dummy">
              <xsd:selector xpath="B"/>
              <xsd:field xpath="@b"/>
        </xsd:unique>
      </xsd:element>

      <xsd:element name="B" type="BType"/>

      </xsd:schema>

Can anyone tell me what I'm doing wrong?

Thanks,
Marv



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