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

Re: DOM Level 2 needs getElementById method

From: David Brownell <david-b@pacbell.net>
Date: Thu, 07 Oct 1999 08:56:05 -0700
Message-ID: <37FCC295.493C2DB2@pacbell.net>
To: www-dom@w3.org
keshlam@us.ibm.com wrote:
> >I'd like to point out that while getElementById() provides "a way of searching
> >node given an known id", "a way of discovering id" of an element is also
> >equally in need. (the name of which is, e.g. getIdAttributeName() )

This was the second part of my concurrence:  I said we need to see
the relevant attribute typing information.  Coincidentally that's
the same sort of information needed to make the DOM L1 notation and
unparsed entity support be at all useful, in L1 or L2.

My own preference would be for more general support, such as:

	String Attr.getAttributeType ()
		returns "CDATA", "ID", "IDREF", "IDREFS",
			"NMTOKENS" for non-enumerated values
		returns "NOTATION" or "ENUMERATION" else
	int Attr.getEnumerationValueCount ()
		returns zero for non-enumerated values
		else returns number of valid options
	String Attr.getEnumerationValue (int n)
		returns the Nth enumerated value, or null

(The list of enumerated values would more naturally be exposed
as an array -- but I seem to recall problems returning them in
IDL, hence the use of two methods.  I'd prefer a string array.)

Options re where to put such methods:  the attribute (as above);
an extended attribute type (less desirable); or an attribute
declaration object of some kind, which also exposes any default
value defined (something that's already discussed in the DOM spec,
but "hidden"), and whether the value is #REQURED, #FIXED, or #IMPLIED.
Of course that third approach should involve an element declaration
object, since attributes are coupled to elements.

> We expect to address that in Level 3 when we add DTD support.

Sigh.  One of the "last call" comments from me is to get DTD
support into L2 -- and not hold things up any longer for schemas.

>	 Remember that
> there may be more than one attribute declared as having type ID. In DTDs, they
> all share a single ID space; I'm not sure if that's going to be true for XML
> Schemas.

Again, at this point I don't much care what schemas "will" do, since I
know I'll be needing to deal with DTDs even after schemas happen.

Also, it's not uncommon for IDs to be used as external references; so
it'd be wrong to assume that they should only be used in IDREF setups.

- Dave
Received on Thursday, 7 October 1999 11:56:27 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:06 UTC