node_type return one of the constants listed in the chapter "predefined constants"
DomNode->node_type
(No version information available, might be only in CVS)
DomNode->node_type — Devuelve el tipo de nodo
Descripción
int DomNode->node_type
( void
)
Devuelve el tipo del nodo. Todos los tipos posibles son listados en la tabla de la introducción.
<?php
include 'ejemplo.inc';
$dom = domxml_open_mem($cadena_xml);
$capitulo = $dom->document_element();
// Veamos los elementos contenidos en capitulo
foreach($capitulo->child_nodes() as $nodo) {
if ($nodo->node_type() == XML_ELEMENT_NODE) {
echo $nodo->node_name() . "\n";
}
}
?>
El resultado del ejemplo seria:
title para
DomNode->node_type
dysmann
13-Apr-2008 01:14
13-Apr-2008 01:14
wasti dot redl at gmx dot net
23-May-2005 10:40
23-May-2005 10:40
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.
17-Jun-2003 09:37
Doesn't pick up nodes of type XML_ATTRIBUTE_NODE (attributes)
Use DomNode->has_attributes() then DomNode->attributes() to retrieve a list (NameNodeMap object) of Attr objects for current node.
Is likely to be a parser issue, I'm using version 2.4.19-4 of libxml2.
Pete.
