W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2000

IDREF question

From: Kevin Regan <kevinr@valicert.com>
Date: Sun, 11 Jun 2000 19:11:06 -0700 (PDT)
To: www-dom@w3.org
Message-id: <Pine.SOL.4.21.0006111857040.14293-100000@bugs.valicert.com>

DOM Level 2 introduced the Document.getElementById() method.
It seems that implementations that support this will determine
which attributes are IDREFs and keep this information in
the DOM, allowing users of the DOM to access a give Element
by its ID.  However, there does not seem to be a way, given
an Element, to get its ID (without knowing about the DTD).

It might be useful to have the reciprocal calls:

String Element.getId();
String Document.getElementById();

In addition, it would be useful, while building a DOM from
scratch, to be able to set ID attributes within a newly
created Element.  This would allow an identical DOM to be
contructed as one that was read from a file.  The idea would
be to implement:

Element.setId(String id);

while having Doument.getElementById() recognize the change.

Towards this goal, it might also be useful to set which
attributes were "specified".  Something like Attr.setSpecified()
might be useful here.

My goal is to be able to build a DOM tree identical to a DOM tree
that would be produced by parsing a given file.  An additional goal
would be to move info from one DOM to another (or to a separate
data structure such as JDOM, while preserving the ID and
"specified attribute" information.

Thanks,
Kevin Regan
kevinr@valicert.com
Received on Sunday, 11 June 2000 22:10:58 GMT

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