OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespace: what's the correct usage?



----- Original Message -----
From: "Jeff Rafter" <jeffrafter@earthlink.net>
To: <xml-dev@lists.xml.org>
Sent: Tuesday, May 22, 2001 6:32 PM
Subject: Re: Namespace: what's the correct usage?


> I find myself becoming more and more confused:
>
> 1) When there is an unqualified element as a child of an element with a
> qualified namespace the child is said to have an "absent target
namespace".
> Is the intent of the _XML Schema_ spec that this child element should be
> treated as a chameleon (thus treated as a member of the default namespace
in
> context) or treated as an element with no namespace regardless any default
> namespace declaration?

XML Schema is defined at the infoset level not the serialized syntax level.
The former situation you describe never occurs because default namespace
decls are a serialization detail.

XML Schema takes the latter approach; when a schema says an element is
unqualified it means exactly that. The element has a namespace name of "".
The element *never* takes on any default namespace that might be in scope.

>
> <{foo namespace}foo>
>   <{bar namespace}bar>
>     <!-- According to XML Namespaces only: foo? -->
>     <!-- According to XML Schemas only: foo or bar or absent? -->
>     <{?}child/>
>   </{bar namespace}bar>
> </{foo namespace}foo>
>
> 2) Should mixed unqualified and qualified elements be allowed at all? If
not
> what can be done at this point?
>
> I have put up a couple of samples up at
>
> http://xml.defined.net/samples/schema/schema1.xsd
> http://xml.defined.net/samples/schema/schema2.xsd
> http://xml.defined.net/samples/schema/schema3.xsd
> http://xml.defined.net/samples/schema/instance1.xml
>
> instance1 + schema1 + schema2 is meant to show ambiguity.
> instance1 + schema1 + schema3 is meant to show something potentially
> erroneous.

AFAICT none of the schemas above are valid. I've posted what I *think* you
meant at[1-3]. The ( assumed ) problem with the schema docs is that you
refer to types in the default namespace but no default namespace is in
scope. Of course, it's entirely possible I've missed the point of your
examples...

I think your point is that in the instance document the <child/> element
takes on the default namespace in scope. In the schema1/schema2 example the
element would validate against the wildcard ( and hence against the
definition for <child/> in schema1.xsd ). The type of the element in both
cases will be xs:string. As an aside, there is a comment at the top of
schema1.xsd that says 'Notice: no targetNamespace' but the schema does have
a targetNamespace. Is the attribute or the comment erroneous?

The schema1/schema3 example would fail to validate because the schema
expects the <child/> element to be unqualified.

This comes down to two things for me;

1.    Default namespace declarations are evil
2.    XML Schema is defined in terms of the Infoset not angle brackets

Cheers

Gudge

[1] http://marting.develop.com/xsd/rafter/schema1.xsd
[2] http://marting.develop.com/xsd/rafter/schema2.xsd
[3] http://marting.develop.com/xsd/rafter/schema3.xsd