InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IXMLAccess Class Referenceabstract

#include <IXMLAccess.h>

Inheritance diagram for IXMLAccess:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IXMLACCESS }
 

Public Member Functions

virtual void VisitAllElements (IIDXMLElement *rootElement, IXMLHandler *handler)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

Contains utilities for navigating and operating on the XML structure tree. Based around the Visitor pattern.

One way to implement an operation that involves objects in a complex structure is to provide logic in each of their classes to support the operation.

The Visitor pattern provides an alternative way to implement such operations that avoids complicating the classes of the objects in the structure by putting all of the necessary logic in a separate visitor class. The Visitor pattern also allows the logic to be varied by using different visitor classes.

It can be regarded as a generalisation of the Iterator pattern; The Iterator pattern is an alternative to the Visitor pattern when the object structure to be navigated has a linear structure; for instance, Iterator is used in IIDXMLElement to traverse only the children. Here we're interested in the entire sub-tree of dependents.

Member Function Documentation

virtual void IXMLAccess::VisitAllElements (IIDXMLElementrootElement,
IXMLHandlerhandler 
)
pure virtual

This method does the traverse of the subtree of the logical structure starting from rootElement. The methods on the handler (type IXMLHandler) will get called in sequence; every time an element (IIDXMLElement) gets visited, the same sequence of method calls will be sent out to the handler

  • HandleElementBefore sent to the handler
  • iterate over children; HandleAfterNthChild sent to the handler for each child
  • HandleElementAfter
Parameters
rootElementwhere to start traversing the tree from
handlerspecifies the entity that will receive 'callbacks' (method calls on IXMLHandler) as each element is visited