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 Rahul Srivastava <Ra...@Sun.COM> on 2001/12/15 22:03:24 UTC

Re: 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.

> John Black wrote...
> 
> 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> 

The schema code is invalid as per pt. 2 of clause 3.4.3 which says:

     If the <simpleContent> alternative is chosen, the type definition
     ·resolved· to by the ·actual value· of the base [attribute] must be either
     a complex type definition whose {content type} is a simple type definition
     or, only if the <extension> alternative is also chosen, a simple type
     definition; 

So, I guess xerces is behaving right.

Hope this helps.

Cheers,
Rahul.

>  
> 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


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