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, 13 Nov 2009

view this page in

DOMNode クラス

クラス概要

DOMNode
DOMNode {
/* プロパティ */
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 ;
/* Methods */
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 )
}

プロパティ

nodeName

現在のノード型の正確な名前を返す

nodeValue

その型に応じてノードの値を返す

nodeType

ノードの型を、定義済みの定数 XML_xxx_NODE のいずれかで返す

parentNode

このノードの親を返す

childNodes

このノードのすべての子を含む DOMNodeList。 子が存在しない場合は、空の DOMNodeList

firstChild

このノードの最初の子。存在しない場合は NULL を返す

lastChild

このノードの最後の子。存在しない場合は NULL を返す

previousSibling

このノードの直前のノード。存在しない場合は NULL を返す

nextSibling

このノードの直後のノード。存在しない場合は NULL を返す

attributes

このノードが DOMElement の場合は ノードの属性を含む DOMNamedNodeMap、 それ以外の場合は NULL

ownerDocument

このノードに関連付けられている DOMDocument オブジェクト

namespaceURI

このノードの名前空間 URI。指定されていない場合は NULL

prefix

このノードの名前空間プレフィックス。指定されていない場合は NULL

localName

このノードの名前のローカル部分を返す

baseURI

このノードの完全なベース URI。もし実装が完全な URL を できなかった場合は NULL

textContent

このノードとその子孫ノードのテキストを返す

目次



DOMNode::appendChild> <DOMNamedNodeMap::item
Last updated: Fri, 13 Nov 2009
 
add a note add a note User Contributed Notes
DOMNode
Steve K
03-Nov-2009 07: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 03: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 12:39
And apparently also a setAttribute method too:

$node->setAttribute( 'attrName' , 'value' );
jorge dot hebrard at gmail dot com
24-Jan-2009 01: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 07: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, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites