According to the schema spec
(http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#coss-ct):
In a complexType definition, if the base is a simple type, you must use 'extension' as
the derivation method.
Schema Component Constraint: Complex Type Definition Properties Correct
All of the following must be true:
1 ...
2 If the {base type definition} is a simple type definition, the {derivation method}
must be extension.
3 ...
Khaled
"Grey, Anthony A" wrote:
> The following schema definition produces an exception in the Xerces
> validator (version 1.5.1, line 2964 of TraverseSchema.cpp file, method
> TraverseSchema::traverseSimpleContentDecl() ): -
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:element name="ServiceCall">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="MiddlewareHeader" minOccurs='1' maxOccurs='1'/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
> <xsd:element name="MiddlewareHeader">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="INF_SVCNAME" type="INF_SVCNAME"
> nillable="false"/>
> <xsd:element name="INF_VERSIONNO"
> type="INF_VERSIONNO" nillable="false"/>
> </xsd:sequence>
> <xsd:attribute name="version" type="xsd:string" use='required'/>
> </xsd:complexType>
> </xsd:element>
>
> <xsd:complexType name="INF_SVCNAME">
> <xsd:simpleContent>
> <xsd:extension base="xsd:string">
> <xsd:attribute name="Row" type="xsd:integer"
> use="optional"/>
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
> <xsd:complexType name="INF_VERSIONNO">
> <xsd:restriction base="xsd:string">
> <xsd:minLength value="1"/>
> <xsd:whiteSpace value="preserve"/>
> <xsd:maxLength value="50"/>
> </xsd:restriction>
> </xsd:complexType>
>
> </xsd:schema>
>
> The error message generated is: -
>
> Error at file d:\xerces-c-src1_5_1\samples\data\Abbey test 2.xml, line 2,
> char 117
> Message: The type 'xsd:string' is a simple type. It cannot be used in a
> derivation by RESTRICTION for a complexType
>
> Error at file d:\xerces-c-src1_5_1\samples\data\Abbey test 2.xml, line 7,
> char 32
> Message: Attribute '{}Row' is not declared for element 'INF_VERSIONNO'
>
> If I change the restriction to an extension, like the INF_SVCNAME element
> (obviously removing the min/maxlength and white space elements) then it
> works fine. The W3C recommendation implies that restriction is a valid
> content type
> (http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-simpleContent),
> so what am I doing wrong?
>
> Tony.
>
> Important:
>
> Internet communications are not necessarily secure and may be intercepted or changed
>after they are sent.
> The Abbey National Group does not accept liability for any such changes. If you wish
>to confirm the origin or content of this communication, please contact the sender
>using an alternative means of communication.
>
> This communication does not create or modify any contract.
>
> If you are not the intended recipient of this communication you should destroy it
>without copying, disclosing or otherwise using its contents. Please notify the sender
>immediately of the error.
>
> The Abbey National Group comprises Abbey National plc and its subsidiary group of
>companies.
>
> Abbey National plc. Registered Office: Abbey House, Baker Street, London, NW1 6XL.
>Reg. No. 2294747.
> Registered in England.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]