[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Unqualified forms and Inheritance by Restriction

  • From: "Toby Considine" <Toby.Considine@gmail.com>
  • To: "xml-Dev Listserv" <xml-dev@lists.xml.org>
  • Date: Fri, 16 Mar 2012 09:47:38 -0400

Unqualified forms and Inheritance by Restriction

I have a family of schemas for energy markets that are derived from a root abstract schema. In most cases, the derived types extend the abstract types by adding additional elements. This inheritance by addition is straight-forward.


For one key abstract type, I use inheritance by restriction. Derived types must have all the elements of the root type, but they may be restricted to a few enumerated values. Consider the following, simplified and stripped down:


Root Schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org/Base" targetNamespace="http://www.example.org/Base" elementFormDefault="qualified">

<xs:element name="A" type="AType"/>

<xs:complexType name="AType" abstract="true">


                                <xs:element name="E1" type="xs:string"/>

                                <xs:element name="E2" type="xs:string" />




Derivative schema

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org/Restriction" xmlns:base="http://www.example.org/Base" targetNamespace="http://www.example.org/Restriction" elementFormDefault="qualified">

<xs:import namespace="http://www.example.org/Base" schemaLocation="Base.xsd"/>

<xs:element name="ARestricted" type="ARestrictedType"/>

<xs:complexType name="ARestrictedType" abstract="false">


                <xs:restriction base="base:AType">


                                                <xs:element name="E1"  type="xs:string" fixed="foo"/>

                                                <xs:element name="E2">


                                                                                <xs:restriction base="xs:token">

                                                                                                <xs:enumeration value="fie"/>

                                                                                                <xs:enumeration value="foe"/>









The derivative schema is invalid. In particular, when processed, each element in ARestricted generates the following error:  "rcase-NameAndTypeOK.1: The declarations' {name}s and {target namespace}s are not the same: restriction element is <xs:element name="itemDescription"> and base element is <xs:element name="itemDescription">."



I can avoid the error if I change each of the schemas from elementFormDefault="qualified" to elementFormDefault="unqualified". The derived schema now validates using XML Spy and Liquid XML Studio. When I use the Liquid Technologies code generation tool to create software objects, the objects generate XML that looks like what I want.


Here’s the question:


Should I be looking for some side effect of switching these schemas from qualified to unqualified? Is there some hidden problem I will come upon if I require conforming schemas to be unqualified? I generally prefer “qualified” for the esthetic reason that I like to see explicit type derivations (prefices) in the schema. I do not have a feel for what else may be affected.






"You can cut all the flowers but you cannot keep spring from coming."
-Pablo Neruda.

Toby Considine
TC9, Inc

TC Chair: oBIX & WS-Calendar

TC Editor: EMIX, EnergyInterop

U.S. National Inst. of Standards and Tech. Smart Grid Architecture Committee


Email: Toby.Considine@g...
Phone: (919)619-2104

blog: www.NewDaedalus.com



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.