[Xpath-ng] Proposal for definition of values/lists

Joe English jenglish at flightlab.com
Tue Nov 26 10:06:42 MST 2002


David Rosenborg wrote:
> [Jeni Tennison]
> >   Every value in XPath NG is a list or an atom. A list is a sequence
> >   of zero or more values. Atoms are of two kinds: nodes and data.
> >   Nodes are atoms that have identity whereas data are atoms that do
> >   not have identity.

> What's the purpose of having two kinds of atoms? Yes, nodes have
> identity, other data types have not. But there are numerous things
> that differentiate value types, what makes the identity property
> so special?

Identity is pretty fundamental; it's what distinguishes
"objects" from "values".  Henry Baker has a nice paper
on this topic [1].

It mostly affects how you treat comparing things for
equality.  Consider the two 'e' elements in the following:

    <doc>
	<e>text</e>
	<e>text</e>
    </doc>

The string-values and node-names of the two nodes are equal,
but the nodes themselves should be considered distinct.

(You could expand the definition of node equality to include
all relevant properties -- the two nodes have different sets
of following-siblings and preceding-siblings, so that could
be used to distinguish them -- but that leads to an even hairier
semantics, with cycles in the data model.)


[1] http://home.pipeline.com/~hbaker1/ObjectIdentity.html

--Joe English

  jenglish at flightlab.com



More information about the Xpath-ng mailing list