Framework / System Layer / Document Object Model / Documents

In This Topic
    Documents
    In This Topic
    In the Nevron DOM documents are root element containers. The abstraction of a document is defined by the INDocument interface.

    Documents serve as registry for all the elements, which reside in it. Each element, which is inserted in a document must be registered by calling the RegisterElement method. The implementation of this method must at least assign an Id to the element (and its possible descendants). In this way every element, which resides in the a document has a non zero Id, which should be unique in the scope of the document. Similarly when an element (and its possible descendants) is removed from a document, it should be unregistered by calling the UnregisterElement method. The implementation of this method must set the element (and its possible descendants) ids to -1 to indicate that they are no longer members of any document. The document itself by default should have its Id set to 0.

    Since any change (insert or remove) of the document structure results in calls to the RegisterElement and UnregisterElement methods, it is easy for documents to also implement element indexing abilities - i.e. a fast way to obtain an element by its Id or UniqueId. This should by design be achieved by the GetElementFromId and GetElementFromUniqueId methods. Although the INDocument as an INElementContainer derivate already declares the means to obtain a child or descendant element by Id or UniqueId, you should, if possible use the document element retrieval methods.

    By design documents are also service providers (INDocument derives from INServiceProvider). 

     Implementation
    The Nevron DOM provides two classes, which can be useful if you want to implement the INDocument interface from scratch. These are NElementIndex and NServiceManager.
    See Also