edit XML with simpleXML

Sure you can edit with SimpleXML:

$input = <<<END
<?xml version='1.0' standalone="yes"?>
<documents>
  <document>
    <name>spec.doc</name>
  </document>
</documents>
END;

$xml = new SimpleXMLElement($input);
$xml->document[0]->name="spec.pdf";
$output = $xml->asXML();

Take a look at the examples.

Leave a Comment