[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Creating a UBL compliant Context
Hey UBL-DEV Please excuse me, if this has been answered before and then please direct me to that answer. We are creating a Danish Context of UBL 1.0, just as we did on 0p7, but this time it shall be fully compliant. My collegue Rasmus Knippel (rak@itst.dk) has allready asked some questions, and to my knowledge not received an answer yet, this is a follow up on his questions since we need answers to finish out work and go for a public hearing in Denmark. Questions by my collegue Rasmus Knippel: http://lists.oasis-open.org/archives/ubl-comment/200406/msg00002.html My question is regarding XML Schema derivation of complexType/complexContent on elements of complexType/complexContent. I've searched through the archives, and not been able to find an answer to my question, the closest is this mail by Eduardo Gutentag, that tries to clarify the meening af the Context Document: http://www.oasis-open.org/archives/ubl-cmsc/200401/msg00001.html <quote> If the user wishes to require the use of the derived type, blocking the possibility of using the original type in an instance, a new derived type must be created from the Order type in the following manner: first derive by restriction, eliminating the element referring to ubl:PartyType from the myns:MyOrderType, then derive by extension adding an element that refers to myns:MyPartyType. </quote> Now finally my question: How should we create a UBL compliant version for Danish Context, where we want to enforce the use of our derived types? Using xsi:types is not acceptable, since it relies on sort of late binding and we want explicit schemas for our version, to be used in development. The suggestion by Eduardo Gutentag, to first eliminate the ubl:party and then add da:party, seems quite contrary to the hole idea of derivation, which leaves me with creating my Party element based on the ubl:Party element using substitutionGroup - is that the way og a way to go?? I've provided a simple example below, that includes this problem: First a "UBL" version: <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://rep.oio.dk/ubl" xmlns:ubl="http://rep.oio.dk/ubl" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="c1" type="xs:string"/> <xs:element name="c2" type="xs:string"/> <xs:element name="c3" type="xs:string"/> <xs:complexType name="PartyType"> <xs:sequence> <xs:element ref="ubl:c1"/> <xs:element ref="ubl:c2" minOccurs="0"/> <xs:element ref="ubl:c3"/> </xs:sequence> </xs:complexType> <xs:element name="Party" type="ubl:PartyType"/> <xs:complexType name="OrderType"> <xs:sequence> <xs:element ref="ubl:Party"/> </xs:sequence> </xs:complexType> <xs:element name="Order" type="ubl:OrderType"> <xs:annotation> <xs:documentation>Comment describing your root element</xs:documentation> </xs:annotation> </xs:element> </xs:schema> Then a danish context version: <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://rep.oio.dk/da" xmlns:ubl="http://rep.oio.dk/ubl" xmlns:da="http://rep.oio.dk/da" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="http://rep.oio.dk/ubl" schemaLocation="ubl-version.xsd"/> <xs:element name="b1" type="xs:string"/> <xs:element name="b2" type="xs:string"/> <xs:element name="a1" type="xs:string"/> <xs:complexType name="RestrictedPartyType" abstract="true"> <xs:complexContent> <xs:restriction base="ubl:PartyType"> <xs:sequence> <xs:element ref="ubl:c1"/> <xs:element ref="ubl:c3"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="PartyType"> <xs:complexContent> <xs:extension base="da:RestrictedPartyType"> <xs:sequence> <xs:element ref="da:b1"/> <xs:element ref="da:b2"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <!-- Here goes the substitutionGroup and the complexType/complexContent/restriction --> <xs:element name="Party" type="da:PartyType" substitutionGroup="ubl:Party"/> <xs:complexType name="RestrictedOrderType"> <xs:complexContent> <xs:restriction base="ubl:OrderType"> <xs:sequence> <xs:element ref="da:Party"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="OrderType"> <xs:complexContent> <xs:extension base="da:RestrictedOrderType"> <xs:sequence> <xs:element ref="da:a1"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="Order" type="da:OrderType" /> </xs:schema> Best regards Brian Nielsen --- Brian Nielsen IT-arkitekt IT Strategisk Kontor bni@itst.dk <mailto:bni@itst.dk> 33 379 134 (direkte) 25 67 07 45 (mobil) IT og Telestyrelsen National IT and Telecom Agency Holsteinsgade 63 DK-2100 København Ø Telf. +45 35 45 00 00 Fax. +45 35 45 00 10 <http://www.itst.dk> itst@itst.dk <mailto:itst@itst.dk> Besøgsadresse: Bredgade 40 1260 København K
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]