At 05:01 PM 9/7/99 +0200, Martijn Faassen wrote:
_make_id() makes sure there are no two elements with the same URL, it does so by making sure there are no two elements with the same id on one level of the URL.
I must be seriously misreading the code then! As I understand it, it goes up the XML tree from the current node until the parent node isn't an XML Node anymore. It would find the top node of the trees this way. Then it checks the next_id attribute there and uses this for the new id. It also increases the _next_id attribute by 1. Wouldn't this guarantee an unique id each time it's called? Perhaps there's something in the way it's called that makes me misread it.. Or I misread the loop that I think goes up the tree?
Dear Martijn, I believe that this is in fact what _make_id does. However, I can imagine scenarios in which moving Nodes around, rebuilding nodes, and the like could allow duplicate ids to exist at different levels of the tree. At this point I don't think that XML Document guarantees that all Node ids in a tree are unique. Let me repeat the XML Document is in *alpha* which means that it may change significantly. If you have strong feelings about how this issue, please write a short proposal/justification and send me patches to implement it. I believe that this whole discussion started because someone wanted to identify Nodes in a sure fire way. I still suggest that folks use a full path such as: myDoc/e15/e27/e66 To identify Nodes of an XML Document. Even if XML Document guarantees that all Node ids in the tree are unique, I still think that is the right way to identify Nodes in most cases. Thanks! -Amos