W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2002

Level 3: Element.setIdAttribute*()

From: Fred L. Drake, Jr. <fdrake@acm.org>
Date: Fri, 1 Nov 2002 17:18:12 -0500
Message-ID: <15810.64932.461573.407589@grendel.zope.com>
To: www-dom@w3.org


Given that I know at least Ray is listening, I'll ask a few questions
about the intentions for the setIdAttribute*() methods being added to
the Element interface.

Let's start with a minimal sample document:

    <!DOCTYPE e [
        <!ATTLIST e id ID #IMPLIED>
    ]>
    <e id="me" attr="you"/>

Let's also presume we have a Level 3 Document representing this
document:

    doc = parse(...)
    e = doc.documentElement
    a1 = e.getAttributeNode("id")
    a2 = e.getAttributeNode("attr")

If at this point we make the call:

    e.setIdAttribute("attr")

then... what happens?  The draft is clear that
doc.getElementById("you") should return the document element in this
case.  What about doc.getElementById("me")?  Is it still considered an
ID?  The specification should be explicit about the interaction with
the "Validity constraint: One ID per Element Type" constraint (XML
1.0 2nd ed., section 3.3.1), validation features, and this method.

Next question:

Is the "ID-ness" of the attribute associated with the element node,
the attribute node, their association, or the association between the
element and the attribute *name*?  If the attribute node is removed
from the element and added to a different element, is it still an ID?
If the attribute node is replaced with another of the same name, does
the new attribute node become an ID, is the original ID restored, or
does the element end up with no ID?

I hope these questions make sense!

A simpler question, also related to IDs:  Is there any expectation
that an attribute or method will be added that allows an application
to get the ID of an element without having to loop over the attribute
nodes and check the isId attribute?


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation
Received on Friday, 1 November 2002 17:18:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT