RE: Number of namespaces are supported by a schema?

> -----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 UTC