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

RE: extending enumerated lists with xsd:union


xsd union complextype
Priscilla,

Is there any way to use a union to expand the substitutable type when the
head element is a complex type with simple content? That is, C2 substituting
for C1 and C2 having additional enumerated values than C1.

Thanks,
Marty Burns

-----Original Message-----
From: Priscilla Walmsley [mailto:pwalmsley-lists@d...] 
Sent: Monday, August 08, 2005 9:23 AM
To: 'Stephen Green'; xml-dev@l...
Subject: RE:  extending enumerated lists with xsd:union

Hi Stephen,

Union is not considered "derivation" for the purposes of substitution
groups.  But your example is more complex than that.  You've got (at least)
two simple times: S1 (the original currency code list) and S2 (your union of
the original with new values.) Then you've got (at least) two complex types:
C1 that uses S1 for its simple content, and C2 that uses S2 for its simple
content.  C2 would not be considered to be derived from C1 just by virtue of
the fact that its content type is "derived by union" from C1's content type.
This would be true whether you were using union or even simple restriction.


If your goal is to version the UBL schemas, have you considered just
creating an entirely new set of schemas with no relation to the previous
version?  (And attempting to control backward compatibility in other ways.)

Hope that helps,
Priscilla

----------------------------------------------------------------- 
Priscilla Walmsley                 http://www.datypic.com 
Author, Definitive XML Schema     (Prentice Hall PTR) 
        Definitive XQuery (coming in 2006)
-----------------------------------------------------------------
 

> -----Original Message-----
> From: Stephen Green [mailto:stephen_green@s...] 
> Sent: Monday, August 08, 2005 8:37 AM
> To: xml-dev@l...
> Subject:  extending enumerated lists with xsd:union
> 
> Greetings xml-dev
> 
> I've been looking at a way to use xsd:union to extend
> a list of enumerated values (a codelist in this case) as
> follows:
> 
> <xsd:schema
> xmlns="urn:oasis:names:prototype:ubl:schema:xsd:CurrencyCode-2.1"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="urn:oasis:names:prototype:ubl:schema:xsd:Curr
> encyCode-2.1"
> xmlns:cur="urn:un:unece:uncefact:codelist:draft:54217:2001"
> xmlns:ccts="urn:oasis:names:draft:ubl:schema:xsd:CoreComponent
> Parameters-1.1
> "
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> version="Ext">
> 
> <!-- ===== Imports ===== -->
> <xsd:import 
> namespace="urn:un:unece:uncefact:codelist:draft:54217:2001"
> schemaLocation="../../../LatestDraft-UBL-2.0/xsdrt/common/Code
> List_CurrencyC
> ode_ISO_7_04.xsd"/>
> 
> <!-- ===== Type Definitions ===== -->
> <xsd:simpleType name="CurrencyCodeContentType">
> <xsd:union memberTypes="cur:CurrencyCodeContentType
> ExtCurrencyCodeContentType" />
> </xsd:simpleType>
> <xsd:simpleType name="ExtCurrencyCodeContentType">
> <xsd:restriction base="xsd:normalizedString">
> <xsd:enumeration value="FQD" />
> </xsd:restriction>
> </xsd:simpleType>
> 
> </xsd:schema>
> 
> where the imported schema contains the original enumerated list I'm
> extending
> 
> <xsd:schema
> targetNamespace="urn:un:unece:uncefact:codelist:draft:54217:2001"
> xmlns:clm54217="urn:un:unece:uncefact:codelist:draft:54217:2001"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xsd:simpleType name="CurrencyCodeContentType">
> <xsd:restriction base="xsd:token">
> <xsd:enumeration value="AED"/>
> <xsd:enumeration value="AFN"/>
> ...
> <xsd:enumeration value="ZMK"/>
> <xsd:enumeration value="ZWD"/>
> </xsd:restriction>
> </xsd:simpleType>
> </xsd:schema>
> 
> Is this a valid derivation from the original CurrencyCodeContentType ?
> 
> I ask because when I try to create a substitutionGroup based 
> in the derived
> type
> substituting an element based on the original type I find 
> that the Microsoft
> Development Environment 2003 (for VS.NET 2003) throws an 
> error claiming
> that the derivation isn't valid.
> 
> I'm aware that there is variation still in how parsers support
> substitutionGroups
> and maybe that is the problem here, but equally I'd like any 
> confirmation
> folk
> can give:
> that this is a tool error and/or
> that the derivation using union is sufficient for use in a 
> substitution
> group
> 
> 
> My substitution looks like this:
> 
> <xsd:element name="PricingCurrencyCode"
> substitutionGroup="cbc:PricingCurrencyCode" 
> type="PricingCurrencyCodeType"
> />
> 
> ...
> <xsd:complexType name="PricingCurrencyCodeType">
> <xsd:simpleContent>
> <xsd:extension base="sdt2-1:CurrencyCodeType"/>
> </xsd:simpleContent>
> </xsd:complexType>
> 
> where the sdt21:CurrencyCodeType looks like
> 
> <xsd:complexType name="CurrencyCodeType">
> <xsd:simpleContent>
> <xsd:extension base="cur:CurrencyCodeContentType">
> <xsd:attribute name="listID" type="xsd:normalizedString" fixed="4217"
> use="optional"/>
> ...
> <xsd:attribute name="listSchemeURI" type="xsd:anyURI"
> fixed="urn:oasis:names:prototype:ubl:schema:xsd:CurrencyCode-Ext"
> use="optional"/>
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
> 
> 
> The error message I get tells me:
> 
> C:\Documents and
> Settings\admin\Desktop\SubstitutionGroups\Prototype-UBL-2.1\xs
> drt\common\UBL
> -CommonBasicComponents-2.1.xsd(21):
> 'urn:oasis:names:prototype:ubl:schema:xsd:CommonBasicComponent
> s-2.1:PricingC
> urrencyCode' cannot be a member of substitution group with 
> head element
> 'urn:oasis:names:draft:ubl:schema:xsd:CommonBasicComponents-2.
> 0:PricingCurre
> ncyCode'. An error occurred at C:\Documents and
> Settings\admin\Desktop\SubstitutionGroups\Prototype-UBL-2.1\xs
> drt\common\UBL
> -CommonBasicComponents-2.1.xsd, (21, 3).
> 
> C:\Documents and
> Settings\admin\Desktop\SubstitutionGroups\Prototype-UBL-2.1\xs
> drt\common\UBL
> -CommonBasicComponents-2.1.xsd(40): Invalid attribute 
> restriction. An error
> occurred at file:///C:/Documents and
> Settings/admin/Desktop/SubstitutionGroups/Prototype-UBL-2.1/xs
> drt/common/UBL
> -SpecializedDatatypes-2.1.xsd, (40, 10).
> 
> 
> XML Spy 2005 gives no such error and valids an instance with
> 
> ...
> <cbc:Note>sample</cbc:Note>
> <cbc2-1:PricingCurrencyCode>FQD</cbc2-1:PricingCurrencyCode>
> <cbc:LineExtensionTotalAmount
> currencyID="GBP">100.00</cbc:LineExtensionTotalAmount>
> ...
> 
> as valid.
> 
> I attach a set of schemas which I've been using (zip file 
> with extension
> renamed to .zzz).
> 
> Many thanks
> 
> Stephen Green
> 



-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://www.oasis-open.org/mlmanage/index.php>


PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.