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 John Black <Jo...@deltek.com> on 2001/12/15 16:05:07 UTC

Schema error: Anonymous complexType: ct-props-correct.2: The type 'xs:string' is a simple type. It cannot be used in a derivation by REST RICTION for a complexType.

I am running xerces.jar 1.4.4 using an example downloaded from McLaughlin's
book Java and XML 2cd edition.  While parsing the following element
definition I get the error report listed below.  I believe the schema code
to be valid.  Does anyone know why xerces would fail with that error?
 
  <xs:element name="title">
    <xs:complexType>
      <xs:simpleContent>
        <xs:restriction base="xs:string">
          <xs:attribute ref="ora:series" use="required" />
        </xs:restriction>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element> 
 
Debug (09:52:13): javaxml2.SAXTreeValidator.class successfully loaded
main (09:52:24): **Parsing Error**
main (09:52:24):   Line:    5
main (09:52:24):   URI:     file:///C:/java/javaxml2/ch03/xml/contents.xml
<file:///C:/java/javaxml2/ch03/xml/contents.xml> 
main (09:52:24):   Message: Schema error: Anonymous complexType:
ct-props-correct.2: The type 'xs:string' is a simple type.  It cannot be
used in a derivation by RESTRICTION for a complexType.
main (09:52:24): org.xml.sax.SAXException: Error encountered
main (09:52:24):     at
javaxml2.JValidatorErrorHandler.error(SAXTreeValidator.java:495)
main (09:52:24):     at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1249)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.reportSchemaError(Travers
eSchema.java:8946)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.reportGenericSchemaError(
TraverseSchema.java:8933)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.handleComplexTypeError(Tr
averseSchema.java:4002)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.traverseComplexTypeDecl(T
raverseSchema.java:3463)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.traverseComplexTypeDecl(T
raverseSchema.java:3286)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.traverseElementDecl(Trave
rseSchema.java:6820)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.doTraverseSchema(Traverse
Schema.java:736)
main (09:52:24):     at
org.apache.xerces.validators.schema.TraverseSchema.<init>(TraverseSchema.jav
a:541)
main (09:52:24):     at
org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(XMLVal
idator.java:2861)
main (09:52:24):     at
org.apache.xerces.validators.common.XMLValidator.parseSchemas(XMLValidator.j
ava:2747)
main (09:52:24):     at
org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndA
ttributes(XMLValidator.java:2688)
main (09:52:24):     at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidat
or.java:1218)
main (09:52:24):     at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanne
r.java:1806)
main (09:52:24):     at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:949)
main (09:52:24):     at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:381)
main (09:52:24):     at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
main (09:52:24):     at
javaxml2.SAXTreeValidator.buildTree(SAXTreeValidator.java:144)
main (09:52:24):     at
javaxml2.SAXTreeValidator.init(SAXTreeValidator.java:103)
main (09:52:24):     at
javaxml2.SAXTreeValidator.main(SAXTreeValidator.java:159)

Thanks,
John Black