XML Änderung (Zugriff über Attribut)
Christian Spitschan
- php
Hallo,
Ich möchte den Inhalt eines XML Elementes über PHP ändern.
In Worten: Ändere diesjenige Element meiner XML Datei, welches
als Attribut den Wert 'xy' besitzt.
<?php
include 'example.php';
$xml = simplexml_load_string($xmlstr);
foreach ($xml->movie[0]->rating as $rating) {
switch((string) $rating['type']) {
case 'thumbs':
$rating = '10';
break;
case 'stars':
$rating = '5';
break;
}
}
$xml->asXML('new.xml');
?>
Hallo,
Ich möchte den Inhalt eines XML Elementes über PHP ändern.
In Worten: Ändere diesjenige Element meiner XML Datei, welches
als Attribut den Wert 'xy' besitzt.
[...]
Und was ist nun deine Frage?
Grüße
Thomas