Hallo zusammen,
danke euch für die Hilfe.
Weil er über $news->options->option iterieren möchte. $news ist ja nur ein Objekt, kein Array (oder eine Traversable-Implementation).
ja genau. Ich brauche eigentlich nur die einzelnen Werte die zwischen <option> liegen.
Ein var_dump zeigt mir folgendes an:
------------------------------------------------------
object(SimpleXMLElement)#6 (1) { ["option"]=> array(3) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(4) { ["mibvalue"]=> string(12) "notinstalled" ["optionvalue"]=> string(12) "NotInstalled" ["displayvalue"]=> string(13) "Not Installed" ["dtype"]=> string(1) "s" } } [1]=> object(SimpleXMLElement)#7 (1) { ["@attributes"]=> array(4) { ["mibvalue"]=> string(4) "1378" ["optionvalue"]=> string(10) "LCTALASKAD" ["displayvalue"]=> string(19) "Large Capacity Tray" ["dtype"]=> string(1) "s" } } [2]=> object(SimpleXMLElement)#5 (1) { ["@attributes"]=> array(4) { ["mibvalue"]=> string(4) "1379" ["optionvalue"]=> string(11) "LCTSIBERIAC" ["displayvalue"]=> string(24) "Wide Large Capacity Tray" ["dtype"]=> string(1) "s" } } } }
--------------------------------------------------------
Also müssten doch die Werte im XML Objekt drin sein oder?
Ich kapier aber einfach nicht, wie ich die <option> ansprechen kann?
$xml = simplexml_load_file($filename);
if($xml) {
foreach($xml->DeviceInstallableOption[0]->feature as $news) {
echo $news->description . "<br />";
echo $news->displayname . "<br />";
//echo $news->options . "<br />";
var_dump($news->options[0]);
echo "<hr />";
}//foreach
} else {
echo '<p>Die Datei names '. $filename .' konnte nicht geöffnet
werden</p>';
}
vielen Dank und viele Grüße
hawk