A function to get the value of an attribute given the name of the desired attribute and the results of attributes() to the second parameter.
<?php
function getAttribute($name, $att)
{
foreach($att as $i)
{
if($i->name()==$name)
return $i->value();
}
}?>
DomNode->attributes
(No version information available, might be only in CVS)
DomNode->attributes — 属性の一覧を返す
説明
array DomNode->attributes
( void
)
この関数は、ノードが XML_ELEMENT_NODE 型の場合に属性の配列を返すだけです。
(PHP >= 4.3 のみ) 属性が存在しない場合、NULL が返されます。
DomNode->attributes
Ian Monroe
29-Nov-2005 05:03
29-Nov-2005 05:03
steve at realappraiser dot net
05-Jan-2005 09:41
05-Jan-2005 09:41
$xpath = $parseDoc->xpath_new_context($parseDoc);
$getResultSearch = $xpath->xpath_eval("//PROPERTY_INFORMATION_RESPONSE/_PRODUCT");
$nodesetResult = $getResultSearch->nodeset;
$var1=$getResultSearch->nodeset[0]->attributes() ;
implode($var1);
print_r ($var1 ) ;
// it prints something like this:::::
Array ( [0] => domattribute Object ( [type] => 2 [name] => _PrettyAttr [value] => Y [0] => 26 [1] => 161068800 ) )
