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 "Anderson, John" <Jo...@Barbadosoft.com> on 2001/12/17 11:47:50 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.

Or to put it simply:
You need to use 
<xs:extension base="xs:string">

John

_______________________________________________________
John Anderson
CTO BarbadosoftTM 
The XML Management Company
+31 (0)20 750 7582 / +31 (0)6 65 347 448 / www.barbadosoft.com

- putting the "X" in "XML" - 


-----Original Message-----
From: Rahul Srivastava [mailto:Rahul.Srivastava@Sun.COM]
Sent: 15 December 2001 22:03
To: xerces-j-user@xml.apache.org
Subject: 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

The information transmitted by this e-mail message is intended solely for
the use of the person to whom or entity to which it is addressed. The
message may contain information that is privileged and confidential.
Disclosure, dissemination, distribution, review, retransmission to, other
use of or taking any action in reliance upon this information by anyone
other than the intended recipient is prohibited. If you are not the intended
recipient, please do not disseminate, distribute or copy this communication,
by e-mail or otherwise. Instead, please notify us immediately by return
e-mail (including the original message with your reply) and then delete and
discard all copies of the message.

Although we have taken precautions to minimize the risk of transmitting
viruses we nevertheless advise you to carry out your own virus checks on any
attachment to this message. We accept no liability for any loss or damage
caused by viruses.