I want to have a php file that adds a child to each product.
I'm using the following php code for this:
Expand|Select|Wrap|Line Numbers
- <?php
- $xdoc = new DomDocument;
- $xdoc->Load('test.xml');
- $product = $xdoc->getElementsByTagName('product')->item(0);
- $newElement = $xdoc ->createElement('store');
- $txtNode = $xdoc ->createTextNode ("admin");
- $newElement -> appendChild($txtNode);
- $product -> appendChild($newElement);
- $test = $xdoc->save("test2.xml");
- echo "<B>Data Added<B>"
- ?>
Any idea how this can be done?
Thanks in advance...