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 "David A. Riggs" <dr...@asset.com> on 2001/08/23 21:23:33 UTC

selector xpath checking conflicts with IBM SQC

I've been validating schemas with IBM's Schema
Quality Checker, and using Xerces to validate
instance documents against the schemas. Untill
now, I've not had any conflict between what the
two tools report as a valid schema, but the
following small file passes Xerces validation
and fails according to SQC. I've not been
able to make SQC happy with it yet; is this
a problem with SQC, with Xerces, or with the
schema spec?

Thanks,
David A. Riggs

###############################################
# Command line validating with Xerces 1.4.3:
###############################################
java -classpath xerces.jar;xercesSamples.jar dom.DOMCount -nvsf
instance.xml

###############################################
# IBM Schema Quality Checker v1.2.004 output:
###############################################
Initializing Schema Quality Checker. Please wait ...

SchemaQualityChecker has been initialized

schema.xsd (file 1 of 1) now being read ...

ERROR

 file = file:D:/SQC/schema.xsd line 18 column 40

SEVERITY: 0

ERROR TYPE: 2

MESSAGE

No node in element http://birch.asset.com:ROOT corresponds to
<xsd:selector xpath="PERSON"/>
 defined in <xsd:key name="PERSON_KEY">
    <selector xpath="PERSON"/>
    <field xpath="@PERSON_ID"/>
</xsd:key>
. Invalid XPath starting from http://birch.asset.com:ROOT:PERSON.

##########################################
# The XML Schema
##########################################
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://birch.asset.com"
            xmlns="http://birch.asset.com"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified">
   <xsd:element name="ROOT">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element name="PERSON" minOccurs="0"
maxOccurs="unbounded">
               <xsd:complexType>
                  <xsd:attribute name="PERSON_ID" type="SSN"
use="required"/>
               </xsd:complexType>
            </xsd:element>
         </xsd:sequence>
      </xsd:complexType>

      <xsd:key name="PERSON_KEY">
         <xsd:selector xpath="PERSON"/>
         <xsd:field xpath="@PERSON_ID"/>
      </xsd:key>

   </xsd:element>

   <xsd:simpleType name="SSN">
      <xsd:restriction base="xsd:string">
         <xsd:length value="9"/>
         <xsd:pattern value="\d{9}"/>
      </xsd:restriction>
   </xsd:simpleType>

</xsd:schema>

#####################################
# The XML Instance used with Xerces
#####################################
<ROOT xmlns="http://birch.asset.com"
      xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation = "http://birch.asset.com  schema.xsd">

   <PERSON PERSON_ID="123456789"/>

</ROOT>


########################################################
David A. Riggs
Science Applications International Corporation - SAIC
 (304)284-9000x201                  driggs@asset.com



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