Peter, I should add a hint to Mitko's answer. An XML entity is a pair of pointer to the whole document and a "bookmark" inside that document. All operations with entities will copy the pointer to the document (but not the document itself) and move "bookmark" in that document, only xml_cut() will really make a copy of a subtree and make its result based on the copy.
The shared document resides in memory as long as it is used in at least one entity, quite straightforward. When operations do not alter the document (i.e., almost always) and when you're not comparing entities, you will not worry whether a single document is shared by entities or few copies are used. However DOM-style functions can write to the document and the change may affect all entities of that document at once ( http://docs.openlinksw.com/virtuoso/xmldom.html ). Best Regards, Ivan Mikhailov OpenLink Software http://virtuoso.openlinksw.com
