XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
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


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


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS