[xml] Navigation via IDs


I'm trying to establish the limitations of navigating around a dynamic
document using IDs in libxml and so I would appreciate any
confirmation/rebuttal of the following:

1. An ID is only usable if the document containing the ID is manipulated
with xmlDoValidityCheckingDefaultValue set to 1.
2. Any nodes added to the document (xmlNewNode) after parsing WILL
NOT have their IDs added to the document's list of IDs.
3. Any nodes removed from the documents(xmlUnlinkNode) after
parsing/validating WILL NOT have their IDs removed from the document's
list of IDs.

The reason I need this information is that I need a way to be able to
reliably search for ids in documents, even if the document has been
modified and nodes inserted/removed and the document HASN'T been

I have been using xmlGetID to do navigation around the document, but I'm
experiencing problems which indicate that new nodes added to the
document are not getting their IDs' registered (hence the above

The approach I'm considering using is taken from the XPointer language
spec, where I do something like this:


where id is assumed to be an attribute of type ID and I abandon use of
xmlGetID altogether.

Thanks for any help/comments.


Gary Pennington
Solaris Kernel Development,
Sun Microsystems
Gary Pennington sun com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]