RE: === Identifying a unique node in a DOM tree ===

Subject: RE: === Identifying a unique node in a DOM tree ===
From: Kevin Williams <Kevin.Williams@xxxxxxxxxxxxxx>
Date: Tue, 30 May 2000 12:45:30 -0400
> If we are to make alterations to a dom tree, and xsl does not actually
> identify a node by xpath in a dependable manner (see quote from xsl list
> below), is there an XML or DOM implementaion that uniquely identifies a
> node?  The purpose is to NOT use a database, but instead a flat xml file
and
> be able to identify and edit a particular node.

I'm not sure what you're asking for here - the DOM, in general, allows the
programmer to operate on individual nodes. XSLT, on the other hand, is
designed to operate on node sets (which may or may not consist of a single
node). If you need some way of identifying the nodes, you can use the
generate-id function in XPath - but I'm not sure that addresses your
problem.

> Although you probably understand what I mean if I was to 
> indicate a path
> like "http://my.xml.com/document.xml#/root/chapter/section";, 
> the fact is
> that that notation CANNOT work.

Only in the sense that a (hypothetical) construct like

c:/documents/root*/chapter*/section*

doesn't work - there's no way to guarantee that the expression only returns
one node (although it might, or it might return no nodes at all). One of the
nice things about XPointer (IMO) is that you can use it to point to more
than one node - you could use it, for example, to embed all the interesting
content from one document in another document without needing to reference
it node-by-node. 
 
- Kevin

Kevin Williams
XML Architect
Ultraprise Corporation


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread