Be aware that XmlSpy's schema validation is a bit weak in a few places,
particularly restriction. It will let you do all sorts of things in a
restricted type that are clearly not legal. I find using Xerces regularly
to double-check my XmlSpy schema work is a necessity--and I've never run
into a case where the two disagreed about validity where Xerces was the one
in error.
Your problem in this case looks like it's with the line
<xs:attribute name="DefaultValue" fixed="996"/>
You've got this attr defined as xs:string in your base type, but are not
specifying the type in the derived type.
Eric
|---------+---------------------------->
| | "PHDB _" |
| | <[EMAIL PROTECTED]|
| | .com> |
| | |
| | 06/20/2003 04:52 |
| | AM |
| | Please respond to|
| | xerces-j-user |
| | |
|---------+---------------------------->
>-----------------------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED]
|
| cc:
|
| Subject: Derivation problem
|
>-----------------------------------------------------------------------------------------------------------------------|
Hello everybody,
I've got a problem with Xerces when validating an XML file. Ths problem
comes from the XML Schema itself,
although designed without any problem with XML Spy 5.
The erroneous part is the following :
-------------------------------------------------
Generator.xsd file
-------------------------------------------------
<xs:complexType name="Field_Type">
<xs:sequence>
<xs:element name="GenericProcess" type
="Process_Type" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="FieldType" type="xs:string" use
="optional"/>
<xs:attribute name="DefaultValue" type="xs:string" use
="optional"/>
<xs:attribute name="NbOfOccurence" type
="xs:nonNegativeInteger"
use="optional"/>
</xs:complexType>
<xs:complexType name="Process_Type">
<xs:attribute name="StepName" type="xs:string" use
="required"/>
<xs:attribute name="Function" type="xs:string" use
="required"/>
</xs:complexType>
<xs:complexType name="TextTableReference">
<xs:complexContent>
<xs:restriction base="Field_Type">
<xs:sequence>
<xs:element name
="GenericProcess" type="Process_Type" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="DefaultValue"
fixed="996"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
--------------------------------------------------
Xerces gives me :
[Error] Generator.xsd:183:18: derivation-ok-restriction.2.1.2: Error for
type 'TextTableReference'. An
attribute use in this type has a type which is not validly derived from the
type of the matching attribute
use in the base type.
---->I have this error because of the fixed="996", and even because of the
xs:attribute presence under
restriction as far as I understand.
[Error] Generator.xsd:180:44: cos-particle-restrict.2: Forbidden particle
restriction:
'any:choice,sequence,all,elt'.
[Error] Generator.xsd:180:44: derivation-ok-restriction.5.3.2: Error for
type 'TextTableReference'. The
particle of the type is not a valid restriction of the particle of the
base.
----->These two extra errors may me due to the fact that Field_Type has a
child element (Generic Process),
because if I change Field_Type and remove GenericProcess child element, I
only have the first error adn not
the three ones.
I must admit that I don't find really clear the explanations provided by
the
w3c here
http://www.w3.org/TR/xmlschema-1/
Object Oreiented speaking I want to derive TextTableReference from
Field_Type and fixing teh attribute
DefauktValue.
Do you have any solution for my problem, apart from coding
TextTableReference as a standalone type with its
attributes and child, because I have many types derived in the same way as
TextTableReference from
Field_Type.
Thanks in advance for your help.
_________________________________________________________________
Hotmail : un compte GRATUIT qui vous suit partout et tout le temps !
http://g.msn.fr/FR1000/9493
---------------------------------------------------------------------
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]