OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] extending enumerated lists with xsd:union

[ Lists Home | Date Index | Thread Index ]

Priscilla

Many thanks for this. It looks unlikely then that
we will get codelist schemas which are extensible
using derivation. As Marty Burns has asked, we'd
appreciate any ideas for alternatives but we have
of course considered that redeclaration of an
entire new set of schemas without a trail, as it
were, of derivation (polymorphism-like) may be
necessary for codelists (as has been our fall-back
strategy for UBL 1.0).

I personally would like to see substitution groups
used to create minor version schemas from previous
sets of major or minor schemas to provide the 'audit
trail' as it were, though I accept that this complicates
things somewhat. We have looked at the mechanism
(substitution groups without using abstracts) but not
made a decision yet and part of the discussion now
is how it might be applied to codelists. As an interim
plan we aim to make it possible for anyone to extend
our next version schemas (2.0) in this way, though we
remain to decide whether to do so ourselves for minor
versions. Others may wish to use this inheritance
mechanism to customise our schemas but, though
we'd like to ensure this is possible (with all global
elements as well as types), we haven't decided whether
to recommend it.

Thanks again

All the best

Stephen Green


----- Original Message ----- 
From: "Priscilla Walmsley" <pwalmsley-lists@datypic.com>
To: "'Stephen Green'" <stephen_green@seventhproject.co.uk>;
<xml-dev@lists.xml.org>
Sent: Monday, August 08, 2005 2:22 PM
Subject: RE: [xml-dev] 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@seventhproject.co.uk]
> > Sent: Monday, August 08, 2005 8:37 AM
> > To: xml-dev@lists.xml.org
> > Subject: [xml-dev] 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>
>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS