- simplexml_load_string: documentation ( source)
<?php
$data = '<?xml version="1.0" encoding="utf-8" ?>
<note>
<to>
<form>D</form>
<heading>E</heading>
<body>F</body>
</to>
<to>
<form>A</form>
<heading>B</heading>
<body>C</body>
</to>
</note>';
$xml = simplexml_load_string($data);
foreach ($xml->to as $to) {
if ($to->form == 'A') { // našel jsem <to>, ve kterém je <form>A</form>
// a tady s ním můžu pracovat
echo "heading: ".$to->heading."\nbody: ".$to->body;
}
}