I am able to append an element onto the root of my XML document, but not onto a child element of the root. Example:
<hobbies>
<boardgames></>
<sports></>
<stamps></>
</hobbies>
Using the code below, I can append a new element to the <hobbies> root element, but I cannot figure how to append a new element to one of the sub-elements (boardgames, sports, or stamps).
<?php
$dom = new DomDocument();
$dom -> load("hobbies.xml");
$newHobby = $dom -> createElement("music");
$dom -> documentElement -> appendChild ($newHobby);
$dom -> save("newimages.xml");
?>
Any Ideas on how I might create a new element under a non-root element?
Thanks - Chris