IDREF question

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 UTC