This is a sample of my XML document which shows a website sitemap
<?xml version="1.0" encoding="UTF-8"?>
<project name="Esurance 365 Portal">
<elements>
<element name="folderone" path="forms/folderone">
<folder function="model">models</folder>
<folder function="controller">controllers</folder>
<folder function="view">views</folder>
</element>
</elements>
</project>
I would like to use DOMDocument to add another element node above the one illustrated so that it appears as follows
<?xml version="1.0" encoding="UTF-8"?>
<project name="Esurance 365 Portal">
<elements>
<element name="foldertwo" path="forms/foldertwo">
<folder function="model">modelstwo</folder>
<folder function="controller">controllerstwo</folder>
<folder function="view">viewstwo</folder>
</element>
<element name="folderone" path="forms/folderone">
<folder function="model">models</folder>
<folder function="controller">controllers</folder>
<folder function="view">views</folder>
</element>
</elements>
</project>
But from the DOMDocument documentation I cant seem to find even an example that shows me how the new element would be achieved.
The createElement and appendChild methods only show me how to insert the element node but not how to insert the remaining folder child nodes.