Re: [XML-Data] review of current draft

On 16 Jun 2010, at 09:04, Jos de Bruijn wrote:
[snip]
>> I agree that we could limit ourselves to XML documents where all the
>> elements are in a namespace. That would be a restriction, but the  
>> use of
>> namespaces is gaining, if not already prevalent. But the default  
>> is that
>> attributes are not qualified, so, even if the elements are in a  
>> namespace,
>> the attribute will not, in most cases (e.g., attributes are not  
>> qualified,
>> in the RIF schemas).
>>
>> The rec on namespaces consider that attributes belong, de facto,  
>> in the
>> naùmespace of the owner element,

This is false. Unqualified attribute names are in the null namespace  
in all cases. (This is a syntactic matter.) Their *interpretation* is  
left to their host element (this is a semantic matter).

http://www.w3.org/TR/xml-names/#defaulting

"A default namespace declaration applies to all unprefixed element  
names within its scope. Default namespace declarations do not apply  
directly to attribute names; the interpretation of unprefixed  
attributes is determined by the element on which they appear.
If there is a default namespace declaration in scope, the expanded  
name corresponding to an unprefixed element name has the URI of the  
default namespace as its namespace name. If there is no default  
namespace declaration in scope, the namespace name has no value. The  
namespace name for an unprefixed attribute name always has no value.  
In all cases, the local name is local part (which is of course the  
same as the unprefixed name itself)."

The second paragraph has the controlling text, "The namespace name  
for an unprefixed attribute name always has no value. "

>> but the XML schema spec does not say
>> anything about that AFAIK; so, we cannot just use the namespace of  
>> the owner
>> element.
>>
>> And the lexical space of rif:iri is that of absolute IRIs, so, we  
>> cannot
>> have a rif:iri with only a local name :-(
>>
>> That is why I included xs:NCName. But if somebody has a better  
>> solution...
>>
>> One question is: is it possible, for an element, to have two  
>> attributes with
>> the same local name, one being in the same namespace as the  
>> element, the
>> other being in no namespace?

http://www.w3.org/TR/xml-names/#uniqAttrs

"This constraint is equivalent to requiring that no element have two  
attributes with the same expanded name."

In your scenario, as long as the element had a non null namespace  
this would be legal.
So:
	<e:foo xmlns:e="http://ex.org" bar="1" e:bar="1"/>

is namespace well formed

	<foo xmlns="http://ex.org" bar="1" bar="1"/>

Is not.

In:
	<foo xmlns="http://ex.org" xmlns:e="http://ex.org" bar="1"/>
the XPath
	//e:foo
has one answer whereas:
	//@e:foo
is empty.

>> I see nothing that would forbid that case, but
>> if there is, then we could follow the namespace rec and associate
>> namespace-less attributes with the namespace of the owner element.
>
> I believe it is not forbidden.

This tactic will result in inconsistent processing between RIF  
systems and those which conform to XML Namespaces.

I don't say it's "forbidden" because you could, in theory, impose  
this processing as an application level constraint. But you will not  
roundtrip properly and you will treat as equivalent documents which  
are, by the namespace rec, distinct.

Hope this helps.

Cheers,
Bijan.

Received on Wednesday, 16 June 2010 10:35:36 UTC