Level 3: Element.setIdAttribute*()

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

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

If at this point we make the call:


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 L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation

Received on Friday, 1 November 2002 17:18:48 UTC