Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Verwenden Sie die Funktionen simplexml_import_dom() und dom_import_simplexml(), um XML-Knoten zwischen den beiden Erweiterungen auszutauschen.
$xmlJla = <<<EOD
<team name="JLA"><held name="Clark Kent">Superman</held><held name="Bruce Wayne">Batman</
held></team>
EOD;
$xmlAvengers = <<<EOD
<team name="Avengers"><held name="Steve Rogers">Captain America</held><held name="Tony
Stark">Iron Man</held></team>
EOD;
$simpleXmlJla = simplexml_load_string($xmlJla);
$simpleXmlAvengers = simplexml_load_string($xmlAvengers);
$dom = new DOMDocument();
$dom->formatOutput = true;
$team = $dom->appendChild($dom->createElement('team'));
$team->setAttribute('name', 'Amalgam');
$superman = dom_import_simplexml($simpleXmlJla->held[0]);
$superman = $dom->importNode($superman, true);
$team->appendChild($superman);
$ironman = dom_import_simplexml($simpleXmlAvengers->held[1]);
$ironman = $dom->i....