Re: DOM Level 2 needs getElementById method

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",
			"ENTITY", "ENTITIES", "NMTOKEN",
			"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