I got Xml File like
<root>
<firstchild id="1">
<page name="main">
</page>
</firstchild>
</root>
I want to add page for firstchild id="1" in php. How can I add?
$xml='<page name="second"></page>';
$doc = new DOMDocument();
$doc->load($filename);
$fragment = $doc->createDocumentFragment();
$fragment->appendXML($xml);
$doc->documentElement->appendChild($fragment);
$doc->save($filename);
Is there not any method appendXml? I may add it like
`<page name="second">
<inlude file="1.png"></inlude>
<inlude file="2.png"></inlude>
</page>`
I need Shortest Way to Append it