[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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>
xsd xs complextype
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

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.