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 PHDB _ <ph...@hotmail.com> on 2003/06/20 10:52:49 UTC

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: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org