W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2005

Chameleon includes with no targetNamespace imports

From: Kasimier Buchcik <kbuchcik@4commerce.de>
Date: Tue, 06 Sep 2005 17:30:02 +0200
To: XML-SCHEMA <xmlschema-dev@w3.org>
Message-Id: <1126020603.1276.67.camel@librax>

Hi,

A chameleon-include test, which checks what happens with
the components of a schema with no targetNamespace if imported
by a schema, which in turn is a chameleon include - and if
this is allowed at all.

I get positive results from both XSV and Xerces here, but
the spec seems to contradict.

I used Xerces-J 2.7.1 and XSV 2.10 for the test.

(I would like to provide results from Saxon as well, but I
don't know yet how to add Saxon to the schema validators
in my Stylus Studio.)

cham-1.xsd
----------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	targetNamespace="urn:test:foo">
	<xs:include schemaLocation="cham-1.inc.xsd"/>
</xs:schema>

cham-1.inc.xsd
--------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:import schemaLocation="cham-1.imp.xsd"/>
	<xs:element name="foo">
		<xs:complexType>
			<xs:sequence>
				<xs:any namespace="##local" processContents="strict"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

cham-1.imp.xsd
--------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="bar" type="xs:integer"/>		
</xs:schema>

cham-1.xml
----------
<f:foo
	xmlns:f="urn:test:foo"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="urn:test:foo cham-1.xsd">
	<bar>1</bar>
</f:foo>

Validating cham-1.xml against cham-1.xsd
----------------------------------------

This validates with Xerces and XSV.

Note that "cham-1.inc.xsd" has no targetNamespace
attribute and imports a schema with no target namespace.
This seems to violate src-import [1]:

"1.2 If the namespace [attribute] is not present, then the enclosing
<schema> must have a targetNamespace [attribute]"

Are included schemas are exempt from this constraint?

If this is allowed (which should be mentioned by the spec in this
case), then src-include 3.2 [2] should point out more clearly that
only the 'original' components of the included schema should be
"namespace-converted".
I read:

"all the ·schema components· of I, except that anywhere the ·absent·
target namespace name would have appeared, the ·actual value· of the
targetNamespace [attribute] of SIIą is used"

... together with the definition of how components should 'bubble' up
to the importing/including schemas...

"The ·schema components· [...] of a schema corresponding to a <schema>
element information item with one or more <import> element information
items must include not only definitions or declarations corresponding to
the appropriate members of its [children], but also, for each of those
<import> element information items for which clause 2 above is
satisfied, a set of ·schema components· identical to all the ·schema
components· of I."

...this could lead to the assumption that the imported components
(which have an 'absent' target namespace) of the included chameleon
schema need to be converted as well.
On the other side: if the chameleon schema would _include_ another
chameleon schema, then we would convert the namespace in those
components, right? If yes, then this particular difference between
imports and includes should be made clearer.

[1] http://www.w3.org/TR/xmlschema-1/#src-import
[2] http://www.w3.org/TR/xmlschema-1/#src-include

Regards,

Kasimier
Received on Tuesday, 6 September 2005 15:47:51 GMT

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