[Zope] ID's in one XML Document nt unique?

Amos Latteier amos@aracnet.com
Mon, 06 Sep 1999 09:49:59 -0700


At 04:51 PM 9/5/99 -0500, Stephan Richter wrote:
>since you are the creator of XML documents, I wanted to ask you whether the
>node IDs in the XML document tree are not necessarily unique. I have a XML
>document  and I try to create an index. I planned of using the node IDs from
>the tree as my identifiers. But I noticed that I have an ID twice. Yes, it is
>at a different level of the tree.
>
>Is this a bug? Is there another way to accomplish my task?

This is not a bug. It is possible to have a URL like this

  e5/e5/e17

The normal way to get a unique identifier for Zope objects including
Elements of an XML Document for the purposes of indexing is to use a full
URL such as

  FolderA/FolderB/myXMLDoc/e12/e15/e15

One important thing to note about XML Document elements is that when you
re-parse the XML, the parser will create new nodes that probably won't have
the same ids as the old ones. This means you'll have to rebuild your
indexes when you re-parse your xml.

In the future I'll probably add something like

  <foo zope:id="e15">blah</foo>

to help solve this problem. This is a little ways off though. I've got to
get XML Document doing namespaces first, plus more thought (and discussion
with Jim ;-) needs to go into this first.

Hope this helps.

-Amos