downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DOMNode::appendChild> <DOMNamedNodeMap::item
Last updated: Fri, 14 Aug 2009

view this page in

La classe DOMNode

Synopsis de la classe

DOMNode
DOMNode {
/* Propriétés */
public readonly string $nodeName ;
public string $nodeValue ;
public readonly int $nodeType ;
public readonly DOMNode $parentNode ;
public readonly DOMNodeList $childNodes ;
public readonly DOMNode $firstChild ;
public readonly DOMNode $lastChild ;
public readonly DOMNode $previousSibling ;
public readonly DOMNode $nextSibling ;
public readonly DOMNamedNodeMap $attributes ;
public readonly DOMDocument $ownerDocument ;
public readonly string $namespaceURI ;
public string $prefix ;
public readonly string $localName ;
public readonly string $baseURI ;
public string $textContent ;
/* Méthodes */
DOMNode appendChild ( DOMNode $newnode )
DOMNode cloneNode ([ bool $deep ] )
public int getLineNo ( void )
bool hasAttributes ( void )
bool hasChildNodes ( void )
DOMNode insertBefore ( DOMNode $newnode [, DOMNode $refnode ] )
bool isDefaultNamespace ( string $namespaceURI )
bool isSameNode ( DOMNode $node )
bool isSupported ( string $feature , string $version )
string lookupNamespaceURI ( string $prefix )
string lookupPrefix ( string $namespaceURI )
void normalize ( void )
DOMNode removeChild ( DOMNode $oldnode )
DOMNode replaceChild ( DOMNode $newnode , DOMNode $oldnode )
}

Propriétés

nodeName

Retourne le nom, le plus précis, pour le type de noeud courant

nodeValue

La valeur du noeud, suivant son type

nodeType

Récupère le type du noeud. Une des constantes XML_xxx_NODE

parentNode

Le parent de ce noeud

childNodes

Un DOMNodeList qui contient tous les fils de ce noeud. S'il n'y a aucun fils, ce sera un DOMNodeList vide.

firstChild

Le premier fils de ce noeud. S'il n'y a aucun noeud de ce type, retourne NULL.

lastChild

Le dernier fils de ce noeud. S'il n'y a aucun noeud de ce type, retourne NULL.

previousSibling

Le noeud précédant immédiatement ce noeud. S'il n'y a aucun noeud, retourne NULL.

nextSibling

Le noeud suivant immédiatement ce noeud. S'il n'y a aucun noeud, retourne NULL.

attributes

Un DOMNamedNodeMap contenant les attributs de ce noeud (si c'est unDOMElement) ou NULL sinon.

ownerDocument

L'objet DOMDocument associé avec ce noeud.

namespaceURI

L'espace de nom de l'URL pour ce noeud, ou NULL s'il n'est pas spécifié.

prefix

Le préfixe de l'espace de nom de ce noeud, ou NULL s'il n'est pas spécifié.

localName

Retourne la partie locale du nom qualifié du noeud.

baseURI

La base de l'URL absolue du noeud, ou NULL si l'implémentation n'a pas réussi à obtenir l'URL absolue.

textContent

Cet attribut retourne le contenu texte de ce noeud et de ces descendants.

Sommaire



DOMNode::appendChild> <DOMNamedNodeMap::item
Last updated: Fri, 14 Aug 2009
 
add a note add a note User Contributed Notes
DOMNode
Steve K
03-Nov-2009 08:47
This class apparently also has a getElementsByTagName method.

I was able to confirm this by evaluating the output from DOMNodeList->item() against various tests with the is_a() function.
marc at ermshaus dot org
05-May-2009 05:36
It took me forever to find a mapping for the XML_*_NODE constants. So I thought, it'd be handy to paste it here:

 1 XML_ELEMENT_NODE
 2 XML_ATTRIBUTE_NODE
 3 XML_TEXT_NODE
 4 XML_CDATA_SECTION_NODE
 5 XML_ENTITY_REFERENCE_NODE
 6 XML_ENTITY_NODE
 7 XML_PROCESSING_INSTRUCTION_NODE
 8 XML_COMMENT_NODE
 9 XML_DOCUMENT_NODE
10 XML_DOCUMENT_TYPE_NODE
11 XML_DOCUMENT_FRAGMENT_NODE
12 XML_NOTATION_NODE
matt at lamplightdb dot co dot uk
06-Apr-2009 02:39
And apparently also a setAttribute method too:

$node->setAttribute( 'attrName' , 'value' );
jorge dot hebrard at gmail dot com
24-Jan-2009 02:29
Try canonicalization:
<?php
$dom
= new DOMDocument;
$dom->loadHTMLFile('http://www.example.com/');
echo
$dom->documentElement->C14N();
?>

Or output it to a file, using C14NFile()

Undocumented stuff ;)
brian wildwoodassociates.info
08-Dec-2008 08:27
This class has a getAttribute method.

Assume that a DOMNode object $ref contained an anchor taken out of a DOMNode List.  Then

    $url = $ref->getAttribute('href');

would isolate the url associated with the href part of the anchor.

DOMNode::appendChild> <DOMNamedNodeMap::item
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites