Re: Document cleanup suggestions

Attribute: Typo, "can be contain". Possible typo, "entity references will
have... both text nodes and entity reference nodes"; I think "will" should
be "may".  "Has an effective value" needs to be better defined -- the
reference to "this method" (which returns null if there is no effective
value) seems to be talking about getAttribute(), and should probably appear
there, with a comment here that if an attribute has no value there will be
no Attribute object to represent it. That would also clarify the definition
of "specified" a bit, by avoiding the question of whether a non-effective
attribute is or isn't specified. (It doesn't exist, so the question is
moot.)

Re Attribute getName/getValue: Perhaps the answer is that getNodeName and
getNodeValue should adopt these more general names? I like the idea of not
multiplying methods unnecessarily, but I'm not wild about having the call
explicitly reflect the interface hierarchy.


Element: I'm sure it's too late to change this, but I would have preferred
getAttribute (as object) and getAttributeString, rather than getAttribute
(as string) and getAttributeNode. getAttributeNode is really
getAttributeAttribute, after all... and the fact that it's the more general
case also suggests it should have the more general name, so users think
about it first and then decide if they can optimize to getAttributeString.

Re Element's tagName as an Attribute: It _could_ be, but I don't think
that's the right answer from either the philosophical point of view (it
means something slightly different in the document) or for efficiency (this
is likely to be the single datum in the Element which is accessed most
often). Besides, you'd be buying trouble if any DTD ever happened to define
an Attribute which used the same name!

Re Element.getAttributes versus Node.attributes  -- I agree re single call,
though I slightly prefer the getAttributes name. Related question: Are
there any kinds of Node _other_ than Element that have attributes? The only
ones I can think of are in the DTD. Maybe MayHaveAttributes should be a
separate interface implemented only by those types which actually need
it...?

Received on Thursday, 30 July 1998 11:04:28 UTC