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

search for in the

DOMNode::hasAttributes> <DOMNode::cloneNode
Last updated: Fri, 13 Nov 2009

view this page in

DOMNode::getLineNo

(PHP 5 >= 5.3.0)

DOMNode::getLineNoノードが存在する行の番号を取得します。

説明

public int DOMNode::getLineNo ( void )

ノードが定義された行の番号を取得します。

パラメータ

この関数にはパラメータはありません。

返り値

常にノードが定義された行の番号を返します。

例1 DOMNode::getLineNo メソッドの例

<?php
// 以下の例で使うXMLのダンプ
$xml = <<<XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
    <node />
</root>
XML;

// DOMDocumentクラスのインスタンスを生成する
$dom = new DOMDocument;

// XMLをロードする
$dom->loadXML($xml);

// <node> 要素が定義された行がどこにあるかを表示する
printf('The <node> tag is defined on line %d'$dom->getElementsByTagName('node')->item(0)->getLineNo());
?>

上の例の出力は以下となります。

The <node> tag is defined in line 3



add a note add a note User Contributed Notes
DOMNode::getLineNo
There are no user contributed notes for this page.

DOMNode::hasAttributes> <DOMNode::cloneNode
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites