Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Why cant an extended type add an attribute
Why cant an extended type add an attribute [message #598352] Thu, 13 July 2006 08:54
Eclipse UserFriend
Originally posted by:

I have an XSD model where I have extended SchoolBook to extend Book.
However after extending i am able to add elements to the school book but
i am not able to attributes to school book. The attached xsd has an
element an attribute for school book. Commenting out, the attribute
makes the schema valid.

I am curious to know why this restriction is present in the first place?


<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U ( by Kannan
Ekanath (Tavant) -->
<xsd:schema xmlns:xsd=""
ecore:documentRoot="library" ecore:package="tavant.platform.infra">
<xsd:complexType name="Book">
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="pages" type="xsd:int"/>
<xsd:complexType name="Writer">
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="books" type="xsd:anyURI" minOccurs="0"
maxOccurs="unbounded" ecore:opposite="author" ecore:reference="Book"/>
<xsd:element name="library">
<xsd:element name="writers" type="Writer" minOccurs="0"
<xsd:element name="books" type="Book" minOccurs="0"
<xsd:element name="schoolbooks" type="SchoolBook" minOccurs="0"
<xsd:complexType name="SchoolBook">
<xsd:extension base="Book">
<xsd:element name="schoolName" type="xsd:string"/>
<xsd:attribute name="yyy" type="xsd:string"/>
Previous Topic:The xs:element with a ref attribute does not show the link
Next Topic:Why cant an extended type add an attribute
Goto Forum:

Current Time: Tue Oct 25 23:00:36 GMT 2016

Powered by FUDForum. Page generated in 0.01554 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software