RE: element attributes with non-schema namespace

Hi Dave,

This should be allowed. It sounds like a bug in whichever tool you are
using.

In the definition you copied from the schema for schemas, the complex type
"element" extends the complex type "annotated", which itself extends the
complex type "openAttrs".  The "openAttrs" complex type is the one that has
the attribute wildcard, allowing attributes in any other namespace.

Hope that helps,

Priscilla Walmsley
Vitria Technology

> -----Original Message-----
> From: D Gross [mailto:justdave@onebox.com]
> Sent: Monday, August 06, 2001 6:27 PM
> To: www-xml-schema-comments@w3.org
> Subject: element attributes with non-schema namespace
>
>
> I have a question about attributes with a non-schema namespace in an
> element definition.  For example, I want to define a
> "my:attr" attribute
> in the following way:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified"
> xmlns:my="http://my.name.space">
> 	<xsd:element name="test" my:attr="something"/>
> </xsd:schema>
>
> A tool I am using which is supposed to be compliant with the new XML
> Schema Recommendation complains with:
>
> "This file is not valid: Unexpected attribute 'my:attr' in
> element 'xsd:element'"
>
> This should be allowable, according to the XML Schema spec.  Note the
> "{any attributes with non-schema namespace . . .}" below:
>
> <element
>   abstract = boolean : false
>   block = (#all | List of (extension | restriction | substitution))
>   default = string
>   final = (#all | List of (extension | restriction))
>   fixed = string
>   form = (qualified | unqualified)
>   id = ID
>   maxOccurs = (nonNegativeInteger | unbounded)  : 1
>   minOccurs = nonNegativeInteger : 1
>   name = NCName
>   nillable = boolean : false
>   ref = QName
>   substitutionGroup = QName
>   type = QName
>   {any attributes with non-schema namespace . . .}>
>   Content: (annotation?, ((simpleType | complexType)?, (unique | key
> | keyref)*))
> </element>
>
> Then I looked at the relevant XML schema definition in XMLSchema.xml
> off of the w3c website:
>
> 	<xs:complexType name="element" abstract="true">
> 		<xs:annotation>
> 			<xs:documentation>
>    The element element can be used either
>    at the top level to define an element-type binding globally,
>    or within a content model to either reference a globally-defined
>    element or type or declare an element-type binding locally.
>    The ref form is not allowed at the top level.</xs:documentation>
> 		</xs:annotation>
> 		<xs:complexContent>
> 			<xs:extension base="xs:annotated">
> 				<xs:sequence>
> 					<xs:choice minOccurs="0">
> 						<xs:element
> name="simpleType"
> type="xs:localSimpleType"/>
> 						<xs:element
> name="complexType"
> type="xs:localComplexType"/>
> 					</xs:choice>
> 					<xs:group
> ref="xs:identityConstraint"
> minOccurs="0" maxOccurs="unbounded"/>
> 				</xs:sequence>
> 				<xs:attributeGroup ref="xs:defRef"/>
> 				<xs:attribute name="type"
> type="xs:QName"/>
> 				<xs:attribute name="substitutionGroup"
> type="xs:QName"/>
> 				<xs:attributeGroup ref="xs:occurs"/>
> 				<xs:attribute name="default"
> type="xs:string"/>
> 				<xs:attribute name="fixed"
> type="xs:string"/>
> 				<xs:attribute name="nillable"
> type="xs:boolean"
> use="optional" default="false"/>
> 				<xs:attribute name="abstract"
> type="xs:boolean"
> use="optional" default="false"/>
> 				<xs:attribute name="final"
> type="xs:derivationSet"/>
> 				<xs:attribute name="block"
> type="xs:blockSet"/>
> 				<xs:attribute name="form"
> type="xs:formChoice"/>
> 			</xs:extension>
> 		</xs:complexContent>
> 	</xs:complexType>
>
> It doesn't look like it allows for any attribute in a
> non-schema namespace.
>
> I never had a problem doing this before, and was wondering whether one
> could consider this a bug in the tool, or whether the spec
> really doesn't
> allow it.
>
> Thanks,
> -- Dave
>
>
> __________________________________________________
> FREE voicemail, email, and fax...all in one place.
> Sign Up Now! http://www.onebox.com
>

Received on Friday, 17 August 2001 11:43:18 UTC