W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

scoping of namespace prefix

From: Naomi Dushay <Naomi@cs.cornell.edu>
Date: Fri, 30 Nov 2001 15:04:58 -0500 (EST)
Message-ID: <706871B20764CD449DB0E8E3D81C4D430247825A@opus.cs.cornell.edu>
To: <xmlschema-dev@w3.org>
I'm running into a problem with prefix scoping.

My instance document (simplified):

<bar:A xmlns:bar="ignored" xmlns:foo="http://foo.namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="ignored bar.xsd">
	<foo:B xsi:schemaLocation="http://foo.namespace fooB.xsd">
		<foo:Q />
		<foo:R />
	</foo:B>
	<foo:C xsi:schemaLocation="http://foo.namespace fooC.xsd">
		<foo:Y />
		<foo:Z />
	</foo:C>
</bar:A>

I have XML schemas bar.xsd, fooB.xsd and fooC.xsd, all of which are
valid.   I can't find anything in the XML Schema spec that implies the
above instance doc shouldn't work.  But there seems to be a namespace
prefix collision for prefix "foo."   This is true for XSV and for the
topologi Schematron Validator.   

Is this a "bug" in those two validators?
Is it a "feature"?


Note that the two following instance documents validate just fine:

<bar:A xmlns:bar="ignored" xmlns:foo="http://foo.namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="ignored bar.xsd">
	<foo:B xsi:schemaLocation="http://foo.namespace fooB.xsd">
		<foo:Q />
		<foo:R />
	</foo:B>
</bar:A>



<bar:A xmlns:bar="ignored" xmlns:foo="http://foo.namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="ignored bar.xsd">
	<foo:C xsi:schemaLocation="http://foo.namespace fooC.xsd">
		<foo:Y />
		<foo:Z />
	</foo:C>
</bar:A>


Also note that moving the prefix declaration doesn't solve the problem
-- the following also bombs on both validators.

<bar:A xmlns:bar="ignored"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="ignored bar.xsd">
	<foo:B xmlns:foo="http://foo.namespace"
xsi:schemaLocation="http://foo.namespace fooB.xsd">
		<foo:Q />
		<foo:R />
	</foo:B>
	<foo:C xmlns:foo="http://foo.namespace"
xsi:schemaLocation="http://foo.namespace fooC.xsd">
		<foo:Y />
		<foo:Z />
	</foo:C>
</bar:A>



I am happy to send documents to anyone who wants more information.

- Naomi Dushay

Naomi Dushay
Cornell Digital Library Research Group
Department of Computer Science
Cornell University
4130 Upson Hall
Ithaca, NY 14853-7501  USA  

naomi@cs.cornell.edu

607-255-2528 (voice)
Received on Saturday, 1 December 2001 07:25:18 GMT

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