RE: Attributes and Namespaces.

Consider a legal DTD document:

<!ELEMENT my:docel (my:element1, my:element2) >
<!ATTLIST my:docel 
      xmlns:my    CDATA       #FIXED "http://some-namespace/"
>

<!ELEMENT my:element1 EMPTY >
<!ATTLIST my:element1 
      about       CDATA       #FIXED "this is an attr that belongs to
my:element1's 'per-element' space"
>

<!ELEMENT my:element2 EMPTY >
<!ATTLIST my:element2 
      about       CDATA       #FIXED "different attr that belongs to
my:element2's 'per-element' space"
>

Now the XML:
<!DOCTYPE my:docel SYSTEM "...">
<my:docel xmlns:my="http://some-namespace">
      <my:element1 about="this is an attr that belongs to my:element1's
'per-element' space"/>
      <my:element2 about="different attr that belongs to my:element2's
'per-element' space"/>
</my:docel>

'about' on 'my:element1' is clearly a different attribute than 'about' on
my:element2.

You cannot interpret them both as belonging to a namespace bound to the 'my'
prefix in an XML doc, as that would make them both instances of the same
attribute in 'global' space, which would clearly make the DTD fragment above
nonsense.

Even if this behaviour were common practise, it is inconsistent with XML
validation via DTDs and hence, IMHO, it is just plain wrong.  Unqualified
attributes should be in 'per-element' space, i.e. their scope is the element
type they adorn only.  

The RDF spec's treatment of XML namespaces is sloppy.  There are a few
issues in the RDF issues list because of it.  Let's hope that the next one
conforms to other W3C recommendations more precisely.

Regards

Lee


-----Original Message-----
From: Janne Saarela [mailto:janne.saarela@profium.com]
Sent: 29 March 2001 08:09
To: Aaron Swartz
Cc: Hart, Lewis; RDF Interest
Subject: Re: Attributes and Namespaces.


> > <rdf:Description about="http://www.w3.org">
> >        Publisher="World Wide Web Consortium"
> >        Title="W3C Home Page"
> >        Date="1998-10-03T02:27"/>
> 
> Yes, it does. In the second example, no triples should result.
> 
> > If not, why not?
> 
> I don't know the exact reasoning, but I've gathered that there were
> applications that required this to work this way. Perhaps someone with
more
> history than I can explain what those were.

Common practice appears to be to associate unqualified attributes
with the namespace of the element where they appear.

In the previous example, about, Publisher, Title, and Date
would all be associated with the RDF namespace.

[snip]

Regards,
Janne

[1] http://www.w3.org/TR/REC-rdf-syntax/#reservedURI
[2] http://www.w3.org/TR/xmlschema-formal/
--
Janne Saarela <janne.saarela@profium.com>
Profium (former Pro Solutions), Tekniikantie 12, FIN-02150 Espoo
Tel. +358 (0)9 25 172 172 Fax. +358 (0)9 25 172 200
Mob. +358 (0)40 508 4767
Internet: http://www.profium.com

Received on Friday, 30 March 2001 07:37:47 UTC