RE: [xml-dev] Problem with cascading XML Schemas

From
Michael Kay <>
To
'Thorsten Rock' <>,
Date
2008-06-27T12:33:10Z
ID
<F4C2E01B785F47ADAE450A65A4C49F8B@Sealion>
Thread
RE: [xml-dev] Problem with cascading XML Schemas
I can't see anything wrong with this. It works fine in Saxon.

Perhaps you can ignore the warning?

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Thorsten Rock [mailto:] 
> Sent: 27 June 2008 12:52
> To: 
> Subject: [xml-dev] Problem with cascading XML Schemas
> 
> For maximum scalability I want to use cascading xml schemas; 
> for example one schema for basic datatypes (schema A), one 
> for a group of applications (schema B) and one for the 
> application itself (schema C). To keep everything clearly 
> laid out, I'd prefer every schema to have it's own namespace.
> 
> However, if I import schema A into schema B and then import 
> schema B into schema C, I can't access schema A's datatypes 
> from schema C.
> 
> If I import schema A into schema B and then import schema A 
> _and_ schema B into schema C, I get an validation error in 
> schema C ("Warning - one of the grammar(s) returned from the 
> user's grammar pool is in conflict with another grammar").
> 
> SCHEMA A (schema_basic.xsd):
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema	xmlns		= "http://www.acme.org/basic"
> 		targetNamespace	= "http://www.acme.org/basic"
> 		xmlns:xs	= "http://www.w3.org/2001/XMLSchema">
> 	<xs:simpleType name="smallRange">
> 		<xs:restriction base="xs:integer">
> 			<xs:minInclusive value="2"/>
> 			<xs:maxInclusive value="5"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> </xs:schema>
> 
> SCHEMA B (schema_extended.xsd):
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema	xmlns:basic	= "http://www.acme.org/basic"
> 		xmlns		= "http://www.acme.org/extended"
> 		targetNamespace	= "http://www.acme.org/extended"
> 		xmlns:xs	= "http://www.w3.org/2001/XMLSchema">
> 	<xs:import namespace="http://www.acme.org/basic"  
> schemaLocation="schema_basic.xsd"/>
> 	<xs:simpleType name="extendedRange">
> 		<xs:union memberTypes="basic:smallRange">
> 			<xs:simpleType>
> 				<xs:restriction base="xs:string">
> 					<xs:enumeration value="more"/>
> 				</xs:restriction>
> 			</xs:simpleType>
> 		</xs:union>
> 	</xs:simpleType>
> </xs:schema>
> 
> SCHEMA C (schema.xsd):
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema	xmlns:basic	= "http://www.acme.org/basic"
> 		xmlns:ext	= "http://www.acme.org/extended"
> 		xmlns		= "http://www.acme.org/specific"
> 		targetNamespace	= "http://www.acme.org/specific"
> 		xmlns:xs	= "http://www.w3.org/2001/XMLSchema">
> 	<xs:import namespace="http://www.acme.org/basic"  
> schemaLocation="schema_basic.xsd"/>
> 	<xs:import namespace="http://www.acme.org/extended"  
> schemaLocation="schema_extended.xsd"/>
> 	<xs:element name="quantities">
> 		<xs:complexType>
> 			<xs:sequence>
> 				<xs:element name="quantity" 
> type="basic:smallRange"/>
> 				<xs:element 
> name="large_quantity" type="ext:extendedRange"/>
> 			</xs:sequence>
> 		</xs:complexType>
> 	</xs:element>
> </xs:schema>
> 
> What's my mistake here? What would be a sensible approach 
> when I want to keep schema A, B and C in different namespaces?
> 
> Thank you very much
> Thorsten Rock
> 
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: 
> subscribe:  List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>