The DOM recommendations specify that these lists are live meaning that modifying the children of a node should be reflected in a list returned by the getElementsByTagName functions. Currently DOMC does not update a DOM_NodeList returned by the getElementsByTagName functions if source nodes are subsequently removed or if a node is added that should be included.
Example 3. Enumerating the children of an Element
This example illustrates how to enumerate and print each comment child of a DOM_Element node.
for (idx = 0; i < elem->childNodes->length; i++) { DOM_Node *node = DOM_NodeList_item(elem->childNodes, idx); if (node->nodeType == DOM_COMMENT_NODE) { printf("comment: %s\n", DOM_Node_getNodeValue(node)); } }
Synopsis
Description
#include <domc.h> typedef struct { int length; /* other members */ } DOM_NodeList;
The DOM_NodeList_item function
Description
#include <domc.h> DOM_Node *DOM_NodeList_item(DOM_NodeList *this, int index);