getNodesByNodeType

The getNodesByNodeType method of a DOMIT_Document allows you to search the document tree for nodes of a specific type. This is not available in DOMIT! Lite.

You can specify a node type using one of the following constants:

  • DOMIT_ELEMENT_NODE (an integer value of 1)
  • DOMIT_TEXT_NODE (an integer value of 3)
  • DOMIT_CDATA_SECTION_NODE (an integer value of 4)
  • DOMIT_PROCESSING_INSTRUCTION_NODE (an integer value of 7)
  • DOMIT_COMMENT_NODE (an integer value of 8)
  • DOMIT_DOCUMENT_NODE (an integer value of 9)

You must also pass in a contextNode - a node from which the search should start.

The following example returns a DOMIT_NodeList of all DOMIT_TextNodes in the current document:

Warning! In versions of DOMIT! prior to 0.5, this method returned an array, not a DOMIT_NodeList!

$myTextNodeList =& $cdCollection->getNodesByNodeType(DOMIT_TEXT_NODE, $cdCollection);

All the name and title text nodes of the cd collection will be returned in the $myTextNodeList node list.


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.