W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2006

RE: Schema Query re import and defines

From: Kelso, Simon <skels@allstate.com>
Date: Thu, 18 May 2006 15:49:09 +0100
Message-ID: <A7F3605C579AA64B99E75DBC415CA24B18708B67@a0028-xpo0110-s.intl.ad.allstate.com>
To: <xmlschema-dev@w3.org>
Michael

For the benefit of everyone else the example xsd files are shown below:

Extensions.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://localnamespace"
elementFormDefault="qualified" xmlns="http://localnamespace"
	xmlns:main="http://mainnamespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:import namespace="http://mainnamespace"
schemaLocation="main.xsd" />
	<xs:element name="NewEle">
		<xs:complexType>
			<xs:sequence>
				<xs:sequence>
					<xs:element name="NewSubEle"
type="main:MyComplexType"/>
				</xs:sequence>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>



Main.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://mainnamespace"
elementFormDefault="qualified" xmlns="http://mainnamespace"
	xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="TestRootElement">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="ChildElement">
					<xs:complexType>
						<xs:sequence />
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute ref="testatt"></xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="TestGlobalEle">
		<xs:complexType>
			<xs:sequence />
		</xs:complexType>
	</xs:element>
	<xs:complexType name="MyComplexType">
	</xs:complexType>
	<xs:attribute name="testatt"></xs:attribute>
</xs:schema>



Plug-in.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://mainnamespace"
elementFormDefault="qualified" xmlns="http://mainnamespace"
	xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://localnamespace"
schemaLocation="Extensions.xsd"/>
<xs:redefine schemaLocation="Main.xsd">
	<xs:complexType name="MyComplexType">
	<xs:complexContent>
	<xs:extension base="MyComplexType">
	   <xs:sequence>
	   <xs:element name="NewRedefinedEle"></xs:element>
	   </xs:sequence>
	</xs:extension>
	</xs:complexContent>
	</xs:complexType>
</xs:redefine>

</xs:schema>



Thanks

Simon
Received on Thursday, 18 May 2006 14:51:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:54 GMT