Re: xpointer

Sayed sent me this question separately earlier.  I responded as 
follows; I thought it might be useful to others on the list because I 
don't often see discussion of the second option, though it's used 
quite often:


There are two ways to approach the problem.  One is to use XPointers 
that describe the desired location in a way that's more robust when 
the document is changed, e.g. anchoring the pointer to a particular 
string that will always be nearby or only using IDs.  However, while 
this approach gives you increased pointer robustness, it's often 
time-consuming and inefficient to write pointers like this, and it may 
have impractical performance characteristics (e.g., humans may need to 
design the pointers by hand if IDs aren't an option).  Also, it 
doesn't give you 100% robustness.

The more usual way is to use a link management application on top of 
the document management/creation system.  This application keeps track 
of all the linking relationships, and checks to see when documents 
have been changed.  This assumes a "closed world" of documents.


	Eve

AndrewWatt2000@aol.com wrote:

> In a message dated 04/03/02 09:52:36 GMT Standard Time, 
> sayed@cs.uni-sb.de writes:
> 
> 
>     my name is sayed
> 
>     i have one question
> 
>     i have xml documents ( 30 documents) stored in database these
>     document have xpointer. the problem is these documents are updates
>     every time so the xlink and xpointer are not points to the correct
>     elelment after update the document, so the question is how can i now
>     the correct element that the xpointer points to after updates the
>     documents ( this document is stored in database)
> 
> 
> 
> Sayed,
> 
> I guess, although you don't say so, you are using child sequences in 
> XPointers to locate the elements and attributes of interest to you.
> 
> I suggest that you consider (at least going forward) adding an ID 
> attribute to relevant elements. If the document structure changes then 
> the value of the ID attribute remains the same and provides a stable 
> point for an XPointer to use.
> 
> I hope that helps a little.
> 
> Andrew Watt


-- 
Eve Maler                                    +1 781 442 3190
Sun Microsystems XML Technology Center   eve.maler @ sun.com

Received on Tuesday, 5 March 2002 05:30:13 UTC