Posted by Janwillem Borleffs on 06/30/05 00:06
hwcowan@hotmail.com wrote:
> 1. Add a new node / element.
You will need a bit of DOM for this:
// Create a simple xml document
$dom = new DomDocument;
$dom->loadXML('<root />');
// Create an element
$elem = $dom->createElement('child');
// Get the root node and append the new element
$root = $dom->documentElement;
$root->appendChild($elem);
// Continue processing with simplexml
$simple = simplexml_import_dom($dom);
See http://www.php.net/dom for more info.
> 2. Save my changes back to the XML file
http://www.php.net/manual/nl/function.simplexml-element-asxml.php
JW
Navigation:
[Reply to this message]
|