Hi, Tony,

You schema is invalid.  You need to read the www.w3.org XML schema
documents.
Also you might want to get yourself an XML schema validating package
(for example, trial ware from XMLSpy.com) and use it to check your
schema.


Svetlana Kaytsner
Senior Software Engineer
Stellent SCD
[EMAIL PROTECTED]
312.692.5109



-----Original Message-----
From: Grey, Anthony A [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 20, 2001 5:12 AM
To: '[EMAIL PROTECTED]'
Subject: Why does Xerces not allow restriction for a simpleContent type


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-simpleConte
nt),
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]

Reply via email to