Allows to perform an iteration over the documented provided, visiting all nodes inside it. The function allows to configure the iteration module using AxlIterationMode (mode variable) and providing a callback function that will be called for each node found (axlIterationFunc). The function, optionall, allows to provide a user pointer that will be passed to the callback function. See documentation for the callback and the iteration module for more details. Here is an example: void perform_iteration (axlDoc * doc) { // call to iterate axl_doc_iterate (doc, // visit childs before brothers DEEP_ITERATION, // the func to execute: see below show_node_found, // optional user pointer NULL); } bool show_node_found (axlNode * node, axlNode * parent, axlDoc * doc, bool * was_removed, axlPointer ptr) { // Show node found printf ("Node found: %s\n", axl_node_get_name (node)); // If the node is removed inside the iteration // using axl_node_remove or axl_node_replace, you // must notify the iteration system using was_removed // as follow: (* was_removed) = true; // // If you don't remove anything, you don't need to do // anything especial with was_removed. // don't stop iteration return true; } See also alternative APIs:
|