![]() | InDesign SDK 20.5 |
#include <IIDXMLDOMNList.h>
Public Member Functions | |
| IIDXMLDOMNList (const BIB_NAMESPACE::CAXENListDOM &) | |
| virtual int32 | Length () const =0 |
| virtual IIDXMLDOMNode * | GetNthNode (int32 which)=0 |
The IIDXMLDOMNList (DOM NodeList) object provides the abstraction of an ordered collection of nodes.
The items in the node list are accessible via an index, starting from 0.
Node lists are "live", in that any changes to the document tree are immediately reflected in any IIDXMLDOMNLists that may have been created for that tree.
WARNING: Because node lists are "live", the following is a very common error that should be avoided:
// Move children from this node to another IIDXMLDOMNList *nl = parent.getChildNodes(); unsigned int length = nl.getLength(); IIDXMLDOMNList *kid; for (unsigned int i = 0; i < length; ++i) { kid = nl.item(i); if (kid) parent->RemoveChild(kid); //This changes length of nl! }
The index 'i' will exceed the modified length of the list, which will result in 'kid' being invalid.
Invalid Parameters
Unless otherwise indicated, it is an error to use an invalid container (IsValid() == false), or a NULL pointer, as a parameter to any function. In some instances, the requirement that a specific parameter must be valid is repeated in the commentary for the specific function. The lack of any indication in the commentary for the specific function should still be taken to mean that an invalid container or NULL pointer will result in an error.
| pure virtual |
Get a node by index
If 'which' is greater than or equal to the number of nodes in the list, returns nil.
| which | Index into the list, starting with 0. |
| pure virtual |
Get number of nodes in list
The range of valid child node indices is 0 to length-1 inclusive.