- From: Priscilla Walmsley <priscilla@walmsley.com>
- Date: Wed, 23 Jan 2002 15:37:07 -0500
- To: "'Gregory Khanlarov'" <kh_greg@hotmail.com>, <xmlschema-dev@w3.org>
Hi Gregory,
> Is
> the following
> XML instance valid ?
>
> <a xmlns="aaa" q="1" w="2"/>
No, 'w' must be prefixed, because default namespace declarations do not
apply to attributes. It would have to look like this:
<pre:a xmlns:pre="aaa" q="1" pre:w="2"/>
> However, the attribute's namespace is
> considered to be the same as element's namespace if no
> namespace prefix is
> specified for the attribute. Am I right ? So, if there is an
No, the attribute's namespace is _not_ considered to be the same as the
element's. (Although some would say that the attribute is "indirectly
associated with" the element's namespace.)
Another thing I noticed about your type definition (below): since you are
adding attributes to a simple type, this is considered an extension rather
than a restriction. Simply replace "restriction" with "extension" and it
should be fine.
Hope that helps,
Priscilla
------------------------------------------------------------------
Priscilla Walmsley priscilla@walmsley.com
Vitria Technology http://www.vitria.com
Author, Definitive XML Schema (Prentice Hall PTR)
------------------------------------------------------------------
> -----Original Message-----
> From: xmlschema-dev-request@w3.org
> [mailto:xmlschema-dev-request@w3.org]On Behalf Of Gregory Khanlarov
> Sent: Tuesday, January 22, 2002 4:54 PM
> To: xmlschema-dev@w3.org
> Subject: Namespace qualification
>
>
> Hi,
>
> I have namespace qualification question.
> Suppose, we have the following schema:
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="aaa"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified"
> >
> <element name="a">
> <complexType>
> <simpleContent>
> <restriction base="string">
> <attribute name="q"/> <!-- Attribute must
> be unqualified,
> since attributeFormDefault equals to 'unqualified' -->
> <attribute name="w" form="qualified" />
> <!-- Here we
> state that the attribute must be qualified -->
> </restriction>
> </simpleContent>
> </complexType>
> </element>
> </schema>
>
> Thus, we have string-content element "a" with two attributes.
> Attribute 'q'
> must be unqualified and attribute 'w' must be qualified. Is
> the following
> XML instance valid ?
>
> <a xmlns="aaa" q="1" w="2"/>
>
> I believe, this is ambiguos case. According to the spec
> (http://www.w3.org/TR/REC-xml-names/#defaulting) default
> namespaces do not
> apply directly to attributes. However, the attribute's namespace is
> considered to be the same as element's namespace if no
> namespace prefix is
> specified for the attribute. Am I right ? So, if there is an
> error than
> where is it ? In namespace qualification of attribute 'q' or 'w' ?
>
> Thank you,
> Gregory
>
>
>
Received on Wednesday, 23 January 2002 15:37:35 UTC