DomNode->node_type

(No version information available, might be only in CVS)

DomNode->node_type — Returns type of node

Описание

int DomNode->node_type ( void )

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

<?php

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";
  }
}

?>

Результат выполнения данного примера:

title
para
[an error occurred while processing the directive]

Коментарии

That's not a parser issue, that's according to the DOM specification.

> Attr objects inherit the Node interface, but since they are not
> actually child nodes of the element they describe, the DOM does
> not consider them part of the document tree.

They are not child nodes, so they shouldn't be in the child_nodes collection.
2005-05-23 04:40:45
http://php5.kiev.ua/manual/ru/function.domnode-node-type.html
Автор:
node_type return one of the constants listed in the chapter "predefined constants"
2008-04-13 07:14:50
http://php5.kiev.ua/manual/ru/function.domnode-node-type.html

    Поддержать сайт на родительском проекте КГБ