Home › Forums › General XMetaL Discussion › How Do I Detect if a Node is Still in the Document? › Reply To: How Do I Detect if a Node is Still in the Document?
Reply to: How Do I Detect if a Node is Still in the Document?August 11, 2011 at 11:20 pm
That's sort of it. We originally added the non-keyed versions and then (long ago) realized that different integrations and customizations could (and would) step on each other if they were running at the same time. So we added the keyed versions with the intention being to allow developers to avoid these types of conflicts.
When a document is opened ChangedNodes should be zero length. As you change things the ChangedNodes list grows. If you want to reset it you call one of the “Clear*” methods. However, if multiple integrations (with 3rd party software) or customizations (either application-level for Author or document-level for Author and XMAX) use non-keyed version of ChangedNodes and any of them calls one of the “Clear*” methods then that would break one of the others.
When you set a key it associates the document's ChangedNodes with that particular key. This allows you to use the “Clear*” APIs to clear the list associated with that key without affecting any others associated with other keys.
If you are running XMAX (I believe that is the case) you might not need to worry about the key as everything is usually under your control.
XMetaL Author Enterprise is perhaps more frequently integrated with various 3rd party software and customizations, though XMetaL Author Essential can be as well. In particular, we promote the use of XMetaL Author Enterprise for use with CMS systems (because it has a special set of APIs for use specifically with them and Essential does not). XMetaL Reviewer uses the key version of these APIs and other 3rd party software may do as well. Any of these might use a ChangedNodes list and in order to not break the list that others are using they will use the key version.
In theory you might use this for other purposes but we have not done any extensive testing along those lines.