PHP Portal » PHP Handbuch » DomNode->node_type

Werbung

DomNode->node_type


(PHP 4 >= 4.1.0)

DomNode->node_type Returns type of node

Beschreibung

int DomNode->node_type ( void )

Returns the type of the node. All possible types are listed in the table in the introduction.

PHP Code
1
2
3
4
5
6
7
8
9
include 'example.inc'; $dom = domxml_open_mem($xmlstr); $chapter = $dom->document_element(); // Let's see the elements contained in chapter foreach($chapter->child_nodes() as $node) { if ($node->node_type() == XML_ELEMENT_NODE) { echo $node->node_name() . "\n"; } }

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

title
para