Forum und email

DomAttribute->value

(No version information available, might be only in CVS)

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

説明

DomAttribute
string value ( void )

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

例

Example#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 プロパティを使用してください。