XML Search Clarification – Breadth-first Search

The Chilkat XML component library (for C#, VB.NET, ASP.NET, ASP, VB6, FoxPro, Delphi, C++, C, Perl, Ruby, Python, Java, etc.) has a number of Search* methods. These methods search for a node in the XML document matching a specific criteria. For example, SearchForTag searches for the 1st node that has a tag with a specific value.

The general form of a Search* method is this:

foundNode = subTreeRoot.SearchMethod(startNode, ...)

The part of the XML document that is searched is the sub-tree rooted at the calling node (subTreeRoot). The method does a breadth-first traversal of the XML sub-tree (see http://en.wikipedia.org/wiki/Breadth-first_search for more information about breadth-first traversal). The startNode indicates where the search should begin in the traversal. Any nodes found matching the requirement(s) are ignored until the startNode is traversed. To search the entire sub-tree, pass a NULL reference in startNode. If a matching node is found, a reference (or pointer) to it is returned, otherwise a NULL is returned.

Tags :