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 Peter Tornberg <tb...@x-obi.com> on 2002/04/23 10:30:18 UTC

Restriction in ComplexType

Hi,

I have bumbed into a problem with Xerces (1.4.1 I think) that works fine in 
XMLSpy v4.3. I try to validate XML-data using a XML-Schema. XMLSpy thinks it 
looks just fine, while Xerces complains 

Looking at the W3C specs I am prepared to say that I agree with XMLSpy! Am I 
wrong?

--------
I get the following stack trace:
[Error] Schema error: Anonymous complexType: ct-props-correct.2: The type 
'string' is a simple type.  It cannot be used in a derivation by RESTRICTION 
for a complexType.
com.xsign.xerces.org.xml.sax.SAXParseException: Schema error: Anonymous 
complexType: ct-props-correct.2: The type 'string' is a simple type.  It 
cannot be used in a derivation by RESTRICTION for a complexType.
        at 
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1204)
        at 
org.apache.xerces.validators.schema.TraverseSchema.reportSchemaError(TraverseSchema.java:8796)
        at 
org.apache.xerces.validators.schema.TraverseSchema.reportGenericSchemaError(TraverseSchema.java:8783)
        at 
org.apache.xerces.validators.schema.TraverseSchema.handleComplexTypeError(TraverseSchema.java:3974)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseComplexTypeDecl(TraverseSchema.java:3435)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseComplexTypeDecl(TraverseSchema.java:3258)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseElementDecl(TraverseSchema.java:6673)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseChoice(TraverseSchema.java:8413)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseSequence(TraverseSchema.java:8334)
        at 
org.apache.xerces.validators.schema.TraverseSchema.processComplexContent(TraverseSchema.java:4188)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseComplexTypeDecl(TraverseSchema.java:3412)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseComplexTypeDecl(TraverseSchema.java:3258)
        at 
org.apache.xerces.validators.schema.TraverseSchema.traverseElementDecl(TraverseSchema.java:6673)
        at 
org.apache.xerces.validators.schema.TraverseSchema.doTraverseSchema(TraverseSchema.java:741)
        at 
org.apache.xerces.validators.schema.TraverseSchema.<init>(TraverseSchema.java:540)
        at 
org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(XMLValidator.java:2789)
        at 
org.apache.xerces.validators.common.XMLValidator.parseSchemas(XMLValidator.java:2675)
        at 
org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndAttributes(XMLValidator.java:2555)
        at 
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1152)
        at 
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1862)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1005)
        at 
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
        at 
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
        at com.xsign.xml.XMLSchemaCache.validate(Unknown Source)
        at com.xsign.xml.XMLSchemaCache.parse(Unknown Source)
        at com.xsign.xml.XMLSchemaCache.parse(Unknown Source)
        at com.xsign.B2B.AppScope.parse(Unknown Source)
        at testXMLWrappers.main(testXMLWrappers.java:35)


------------
Used XML-Schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://xmlns.x-obi.com/obix/core/notification/alpha" 
        xmlns:signup="http://xmlns.x-obi.com/obix/core/notification/alpha" 
        xmlns:base="http://xmlns.x-obi.com/obix/base" 
        xmlns="http://www.w3.org/2001/XMLSchema">

    <import namespace="http://xmlns.x-obi.com/obix/base" 
schemaLocation="base.xsd"/>

    <element name="Notification">
        <complexType>
            <sequence>
                <choice>
                    <element name="OrderEvent">
                        <complexType>
                            <simpleContent>
                                <restriction base="string">
                                    <enumeration value="Accepted"/>
				    <enumeration value="Rejected"/>
		                            <enumeration value="ReceivedAwaitingClearing"/>
				    <enumeration value="ReceivedAwaitingPayment"/>
				    <enumeration value="ChangeRequest"/>
				    <enumeration value="ChangeAccepted"/>
				    <enumeration value="ChangeDenied"/>
				    <enumeration value="Enquiry"/>
				    <enumeration value="Other"/>				    			
                                                    <attribute name="OrderID" 
type="base:LatinString40" use="required"/>
				</restriction>
                            </simpleContent>
                        </complexType>
                    </element>
                    <element name="ShippingEvent">
                        <complexType>
                            <simpleContent>
                                <restriction base="string">
                                    <enumeration value="Shipped"/>
                                    <enumeration value="Delivered"/>
                                    <enumeration value="AdvanceNotice"/>
                                    <enumeration value="Received"/>
                                    <enumeration value="Accepted"/>
                                    <enumeration value="Enquiry"/>
                                    <enumeration value="Other"/>             
                                    <attribute name="OrderID" 
type="base:LatinString40" use="required"/>
                                </restriction>
                            </simpleContent>                            
                        </complexType>
                    </element>
                </choice>
                <element name="FromPartner" type="base:PartnerData"/>
                <element name="ToPartner" type="base:PartnerData"/>
                <element name="Message" type="base:PseudoHTML" minOccurs="0"/>
            </sequence>
            <attribute name="NotificationID" type="base:LatinString40" 
use="required"/>
            <attribute name="TimeStamp" type="dateTime" use="required"/>
            <attribute name="Language" type="string" use="required"/>
            <attribute name="ReferencedNotificationID" 
type="base:LatinString40" use="optional"/>
        </complexType>
    </element>
</schema>

---

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