sshyran / genxdm

Automatically exported from code.google.com/p/genxdm
0 stars 0 forks source link

Node identity is ill-defined #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Informer.getNodeId() and NodeInformer.getNodeId(N node) both return an Object 
suitable for identity comparison.

This is a simplification of the 'U' parameter found in older (unpublished) 
code.  That, in turn, was developed in order to replicate the DOM-specific 
Node.isSameNode(Node node) method.

The javadoc for Node.isSameNode() looks like this:

"Returns whether this node is the same node as the given one.

This method provides a way to determine whether two 
Node references returned by the implementation reference 
the same object. When two Node references are references 
to the same object, even if through a proxy, the references may be 
used completely interchangeably, such that all attributes have the 
same values and calling the same DOM method on either reference 
always has exactly the same effect."

We need to document this 'node identity' in our own Javadoc, if the getNodeId() 
is to survive and be implementable. It is not clear how one tests this.

Original issue reported on code.google.com by aale...@gmail.com on 18 Jan 2011 at 4:08

GoogleCodeExporter commented 8 years ago
Grr.  *Not* accepted, yet.

Original comment by aale...@gmail.com on 18 Jan 2011 at 4:08

GoogleCodeExporter commented 8 years ago
Section 2.3 of the XDM:

Each node has a unique identity. Every node in an instance of the data model is 
unique: identical to itself, and not identical to any other node. (Atomic 
values do not have identity; every instance of the value “5” as an integer 
is identical to every other instance of the value “5” as an integer.)

Do it this way.  Is this testable?

Original comment by aale...@gmail.com on 18 Jan 2011 at 4:28

GoogleCodeExporter commented 8 years ago
Okay.  Updated the javadoc.  Per suggestion from Anli, added some testing.  We 
now test whether a node accessed by various routes has the same node id 
regardless.  Then we test that two "identical" documents have nodes which all 
have different ids.

This uncovers the lovely fact that axiom's omattribute doesn't conform to the 
rules of identity.  *sigh*

Original comment by aale...@gmail.com on 18 Jan 2011 at 6:09

GoogleCodeExporter commented 8 years ago

Original comment by eric%tib...@gtempaccount.com on 29 Apr 2011 at 11:20