W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

Requirement for attributes with schema scope

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Thu, 6 Jan 2000 14:59:20 -0700
Message-ID: <00E567D938B9D311ACEC00A0C9B468730C7469@THOR>
To: "'xml-dev@ic.ac.uk'" <xml-dev@ic.ac.uk>, "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Section 2.5 of Structures says:

Attributes and local element declarations are special, in that every type defines its own attribute symbol space and local element symbol space, which are distinct from each other. In addition,
top-level elements (whose declarations are not contained within a type definition) reside in their own symbol space.  And the Schema for Schema only allows attribute declarations to appear within the
scope of a type or attributeGroup.

However, you can use the <anyAttribute> element to say that an element in this namespace can have any attribute from an alien namespace.  However, without being able to have an attribute with schema
scope, how do you know which declaration of a given attribute should be used for validation.  For example,

Schema for ThisNamespace:

<schema xmlns="http://www.w3.org/1999/XMLSchema"
 	  targetNamespace="http://www.software.aeat.com/ThisNamespace">

	<element name="someElement">
		<anyAttribute>http://www.software.aeat.com/ThatNamespace</anyAttribute>
	</element>
</schema>

Schema for ThatNamespace:

<schema xmlns="http://www.w3.org/1999/XMLSchema"
 	  targetNamespace="http://www.software.aeat.com/ThatNamespace">

	<element name="coffee">
		<attribute name="temp">
			<datatype>
				<enumeration value="Hot"/>
				<enumeration value="Tepid"/>
			</datatype>
		</attribute>			
	</element>

	<element name="employee">
		<!--  is this employee a temporary  -->
		<attribute name="temp" type="boolean"/>
	</element>
</schema>

Sample Document:

<!--  that:temp is ambiguous, 
	should it be the employee status or the coffee temperature -->
<someElement xmlns="http://www.software.aeat.com/ThisNamespace"
		 xmlns:that=http://www.software.aeat.com/ThatNamespace"
		 that:temp="false"
</someElement>

Resolution:

Attribute declarations need to be able to appear in the scope of a <schema> element.  To allow reuse, <attribute> should also have a ref attribute so that global scoped attributes can appear in a
element without a duplicate definition.  Only attributes with a schema scope should be used to resolve namespace qualified attributes.
Received on Thursday, 6 January 2000 17:01:41 GMT

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