W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2002

RE: Number of namespaces are supported by a schema?

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Fri, 19 Jul 2002 11:18:34 -0700
Message-Id: <8904C60CACA7D51191BC00805FEAAF43D10914@crdc-exch-7.crdc.kp.org>
To: "'tpereira@dsi.uminho.pt'" <tpereira@dsi.uminho.pt>, www-xml-schema-comments@w3.org

> -----Original Message-----
> From:	tpereira@dsi.uminho.pt [SMTP:tpereira@dsi.uminho.pt]
> Sent:	Friday, July 19, 2002 9:15 AM
> To:	www-xml-schema-comments@w3.org
> Subject:	SOS: Number of namespaces are supported by a schema?
> 
> Hi,
> 
> I have 3 namespaces in a DTD, and when i convert this DTD into a
> Schema(using XML Spy) i have an error.
> I think that one schema only supports one namespace.Does anyone can confirm
> this?
> It's really important, i really need to know this.
> 
Each schema document defines a single namespace (or none)...however a schema can be constructed out of many different schema documents, as in:

<!-- in a.xsd -->
<xs:schema
		xmlns:xs='http://www.w3.org/2001/XMLSchema'
		xmlns='http://www.example.com/a'
		xmlns:b='http://www.example.com/b'
		xmlns:c='http://www.example.com/c'
		targetNamespace='http://www.example.com/a'>
	<xs:import namespace='http://www.example.com/b' schemaLocation='b.xsd'/>
	<xs:import namespace='http://www.example.com/c' schemaLocation='c.xsd'/>
	<xs:element name='e1'>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref='b:e1'/>
				<xs:element ref='c:e1'/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

<!-- in b.xsd -->
<xs:schema
		xmlns:xs='http://www.w3.org/2001/XMLSchema'
		xmlns='http://www.example.com/b'
		targetNamespace='http://www.example.com/b'>
	<xs:element name='e1'>
		<xs:complexType>
			<xs:attribute name='a1' type='xs:string'/>
		</xs:complexType>
	</xs:element>
</xs:schema>

<!-- in c.xsd -->
<xs:schema
		xmlns:xs='http://www.w3.org/2001/XMLSchema'
		xmlns='http://www.example.com/c'
		targetNamespace='http://www.example.com/c'>
	<xs:element name='e1'>
		<xs:complexType>
			<xs:attribute name='a1' type='xs:string'/>
		</xs:complexType>
	</xs:element>
</xs:schema>

<!-- in a.xml -->
<a:e1
		xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
		xmlns:a='http://www.example.com/a'
		xmlns:b='http://www.example.com/b'
		xmlns:c='http://www.example.com/c'
		xsi:schemaLocation='http://www.example.com/a a.xsd'>
	<b:e1 a1='v1'/>
	<c:e1 a1='v2'/>
</a:e1>

pvb
Received on Friday, 19 July 2002 16:38:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT