Tom Browder (JIRA) wrote:
> Using the nightly src of 15 Jun 2005, the failure still occurs.  The
> following six programs all validate this pair successfully:  James
> Clark's jing (using the rnc source), xsv, Microsoft's Visual Studio
> C++ Beta 2, Topologi's XML Judge, Sun's MSV, and libxml2's xmllint
> (cvs head as of 9 Jun 2005).
>
> > Xercex C++ 2.6.0. sample program PSVIWriter fails to validate a
> > valid W3C XML schema and instance.
> > --------------------------------------------------------------------
> >------------------------------
> >
> >          Key: XERCESC-1324
> >          URL: http://issues.apache.org/jira/browse/XERCESC-1324
> >      Project: Xerces-C++
> >         Type: Bug
> >   Components: Validating Parser (Schema) (Xerces 1.5 or up only)
> >     Versions: 2.6.0
> >  Environment: Linux Fedora Core 2 (i386 pentium III), Xerces C++
> >     Reporter: Tom Browder
> >  Attachments: tgmtest.xml, tgmtest.xsd
> >
> > The file 'tgmtest.xml' fails to validate against 'tgmtest.xsd' the
> > sample program from xerces c++ (2.6.0):
> > % PSVIWriter -f -o=stdout -e=stderr tgmtest.xml
> > % head -2 stderr
> > Error at file /disk2/local2/src/xerces-c-src_2_6_0/bin/tgmtest.xsd,
> > \ Line 94, Char 43
> > Message:The type 'xs:anyType' specified as the base in the
> > simpleContent\ element must not have complexContent
> > But running the same set against xmllint (from version 20608) works:
> > % xmllint --schema tgmtest.xsd tgmtest.xml > t
> > tgmtest.xml validates
> > A similar bug was found in the jira bug database: XERCESC-697.

I've been investigating a bit into this tonight (it's an annoying old 
issue), and want to report what I've found. Maybe this analysis is a 
help for fixing this issue. (I don't want to fix it myself, because I'm 
not at all familiar with the xerces-way of schema handling).

Firstly, all schema errors are reported at very similar points in the 
schema, e.g.

  <xs:element name="length">
    <xs:complexType>
      <xs:simpleContent>
--->    <xs:restriction base="xs:anyType">
          <xs:simpleType>
            <xs:restriction base="xs:double">
              <xs:minExclusive value="0"/>
            </xs:restriction>
          </xs:simpleType>
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:restriction>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

(BTW: I would not have bet that this schema is valid, from a first 
sight ;)

The missing point here is that a simpleContent has a child that derives 
from anyType, which is per se a complexType ($3.4.7 pt1). This taken 
alone would be a mistake, because simpleContent cannot contain 
complexType, and that's exactly how xerces behaves - it throws 
InvalidComplexTypeInfo.

Maybe this behaviour is too restrictive. A restriction (as a child of 
simpleContent) can only have a simpleType child (besides some other 
constrainings), despite it's base type (§3.4.2 pt1). Maybe it's enough 
to check, if this simpleType child actually is present, and only throw 
InvalidComplexTypeInfo if it's not.

I picked out the piece of code that is responsible for deciding that the 
given schema was not valid (TraverseSchema.cpp, lines 3532 ff):

// check for 'anyType'
if (XMLString::equals(uri, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)
    && XMLString::equals(localPart, SchemaSymbols::fgATTVAL_ANYTYPE)) {

    reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain,
                      XMLErrs::InvalidSimpleContentBase, baseName);
            throw TraverseSchema::InvalidComplexTypeInfo;
}

This should be a good starting point for further investigation and for 
fixing this issue. Hope it helps.

Cheers,
                        Axel

-- 
Humboldt-Universität zu Berlin
Institut für Informatik
Signalverarbeitung und Mustererkennung
Dipl.-Inf. Axel Weiß
Rudower Chaussee 25
12489 Berlin-Adlershof
+49-30-2093-3050
** www.freesp.de **

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

Reply via email to