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

 


Help: OASIS Mailing Lists Help | MarkMail Help

ubl-comment message

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


Subject: [ubl-comment] question about deriving from UBL types



Hi,

I have run into a problem deriving from UBL types that I hope somebody else has solved more satisfactorily than I have.  When trying to derive a restricted address type that set minOccurs to 1 (the UBL type has everything as optional), Xerces2-J kept saying that the derivation was invalid (" There is not a complete functional mapping between the particles," and  "Error:  org.xml.sax.SAXParseException: derivation-ok-restriction.5.3: Error for type 'SimplerAddressType'.  The particle of the type is not a valid restriction of the particle of the base.") 

The following simple files illustrate the trouble.

I am actually trying to derive from the AddressType in the UBL Library schema, but these simplified files illustrate the trouble more clearly. This schema defines the base type that I would like to derive from.  It is a simplified analogue to the UBL library schema (UBL_Library-0p64.xsd), except that I have added a targetNamespace after an earlier response from Eve Maler that stated that the Common Aggregate types would be in its own namespace (the March release version was in no namespace).

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.test.com/sample"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.test.com/sample"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:complexType name="AddressType">
		<xsd:sequence>
			<xsd:element name="Street" type="xsd:string" minOccurs="0"/>
			<xsd:element name="State" type="xsd:string" minOccurs="0"/>
			<xsd:element name="Country" type="xsd:string" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>

The schema that defines the derived type:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.test.com/sample2"; xmlns="http://www.test.com/sample2"; xmlns:s="http://www.test.com/sample"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:import namespace="http://www.test.com/sample"; schemaLocation="sample.xsd"/>
	<xsd:complexType name="SimplerAddressType">
		<xsd:complexContent>
			<xsd:restriction base="s:AddressType">
				<xsd:sequence>
					<xsd:element name="State" type="xsd:string"/>
					<xsd:element name="Country" type="xsd:string"/>
				</xsd:sequence>
			</xsd:restriction>
		</xsd:complexContent>
	</xsd:complexType>
</xsd:schema>

This derivation does not validate.   The problem, I believe, arises from the combination of elementFormDefault's being set to qualified in the base schema and the use of a targetNamespace in the base schema. This means that Address, Street, State, and Country are all in the {http://www.test.com/sample} namespace, and when I try to derive from AddressType, Xerces find that the elements in my derived SimplerAddressType are not in the base type's namespace.  With elementFormDefault set to qualified (as is UBL_Library-0p64.xsd currently) and a targetNamespace (which I was told the Library would have in the future), the effective content model of my base type is as follows: 

	<xsd:complexType name="AddressType">
		<xsd:sequence>
			<xsd:element name="{base_namespace}Street" type="xsd:string" minOccurs="0"/>
			<xsd:element name="{base_namespace}State" type="xsd:string" minOccurs="0"/>
			<xsd:element name="{base_namespace}Country" type="xsd:string" minOccurs="0"/>
		</xsd:sequence>
      </xsd:complexType>

And I am unable to define a derived type in another namespace that has some valid restriction of {base_namespace}Street, {base_namespace}State, {base_namespace}Country.  To make a long story short, I had already changed the base schema so that it is in a namespace, and the only solution that I found to my derivation difficulties was to change the base schema so that it had elementFormDefault set to unqualified and to not use a default namespace in instance documents.  Obviously, changing with the UBL documents is not a solution, and I am wondering if others have been able to derive successfully from the UBL types, and if so, how?

Thanks,

calvin

-------------------------------------
Calvin Smith

Talaris Corporation
1400 Fashion Island Boulevard
San Mateo, CA, 94404
 
(650) 212 8426 phone
 
csmith@talaris.com
http://www.talaris.com



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


Powered by eList eXpress LLC