[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Fw: [xml-dev] extending enumerated lists with xsd:union
Folks, I've forwarded this as it relates to (what I had hoped would work with) the codelists. Marty has requested further advice for which we are waiting. All the best Steve ----- 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> >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]