Take the 2-minute tour ×

I'm trying inherit and restrict an element but I'm getting following error (in eclipse validation):

The particle of the type is not a valid restriction of the particle of the base.

The "Description" element should not be part of the "TypeDevice" element. I just can't get it why. This should be possible (according to this tutorial):

Can anyone help me?



<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com" xmlns="http://www.example.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <!--  Abstract Base Class  -->
  <xs:complexType name="AbstractDevice" abstract="true">
      <xs:element name="Description" type="xs:string" />

  <!--  Inheritance with restriction  -->
  <xs:complexType name="TypeDevice">
      <xs:restriction base="AbstractDevice">                                

  <xs:complexType name="TypeRoot">
      <xs:element name="Device" type="TypeDevice" />
  <xs:element name="Configuration" type="TypeRoot" />
share|improve this question

1 Answer 1

up vote 3 down vote accepted

Type AbstractDevice has two required elements, whereas type TypeDevice has only one. Thus TypeDevice is not a valid instance of its base type AbstractDevice. In order to make it valid, you should add minOccurs="0" to Description element or turn the derivation around and use extension.

share|improve this answer
Thanks for your answer. But I thought, this was exactly what can be done with a restriction applied to an element. The linked tutorial does exactly this (restrict an element "Author" of the base type "Book" in the derived elment "Pamphlet" by restriction. Maybe I do misunderstand something here. By the way, it's not possible in my implementation to set Description to "minOccurs=0" in the base element. –  Bill Feb 19 '13 at 7:05

Your Answer


