Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
$xml=simplexml_load_file("Fleurop.xml");
foreach($xml->product[0] as $xx){
...
}
SimpleXMLElement Object ( [@attributes] => Array ( [id] => 1111 ) )
SimpleXMLElement Object ( [name] => Blabla Name [description] => Array ( [0] => Beschreibungstext [1] => Beschreibungstext ) [manufacturer] => Gerstellername [shippinghandling] => SimpleXMLElement Object ( [@attributes] => Array ( [cost] => 4.00 ) ) )
SimpleXMLElement Object ( [merchant] => Blumen )
SimpleXMLElement Object ( [deeplink] => https://ad.zanox.com/..... [image] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [state] => small ) => https://www....xgebtorte_p.gif ... bekomme schon nicht hin die ID auszulesen :(
Suppose you have loaded a XML file into $simpleXML_obj.
The structure is like below :
SimpleXMLElement Object
(
[node1] => SimpleXMLElement Object
(
[subnode1] => value1
[subnode2] => value2
[subnode3] => value3
)
[node2] => SimpleXMLElement Object
(
[subnode4] => value4
[subnode5] => value5
[subnode6] => value6
)
)
When searching a specific node in the object, you may use this function :
<?php
function &getXMLnode($object, $param) {
foreach($object as $key => $value) {
if(isset($object->$key->$param)) {
return $object->$key->$param;
}
if(is_object($object->$key)&&!empty($object->$key)) {
$new_obj = $object->$key;
$ret = getCfgParam($new_obj, $param);
}
}
if($ret) return (string) $ret;
return false;
}
?>
So if you want to get subnode4 value you may use this function like this :
<?php
$result = getXMLnode($simpleXML_obj, 'subnode4');
echo $result;
?>
It display "value4"