DOM XML (PHP 4) 関数
PHP Manual

DomAttribute->value

(PHP 4 >= 4.1.0)

DomAttribute->value — 属性の値を返す

説明

string DomAttribute::value ( void )

この関数は属性の値を返します。

例

例1 ノードの全ての属性を取得する

<?php

include("example.inc");

if (!
$dom = domxml_open_mem($xmlstr)) {
     echo 
"Error while parsing the document\n";
     exit;
}

$root = $dom->document_element();
$attrs = $root->attributes();

echo 
'Attributes of ' . $root->node_name() . "\n";
foreach (
$attrs as $attribute) {
     echo 
' - ' . $attribute->name . ' : ' . $attribute->value . "\n";
}

?>

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

Attributes of chapter
 - language : en

返り値

Returns the value of the attribute.

PHP 5 への移行

DOMAttr の value プロパティを使用してください。

参考


DOM XML (PHP 4) 関数
PHP Manual