All of the examples I can find online about this involve simply adding content to an XML file at the document root, but I really need to do it deeper than that.
My XML file is simple, I have:
<?xml v1 etc>
All I want to be able to do is add new "item" elements, each with a title and link. I know I need to be using PHP DOM, but I(m stumped as to how to code it so that it adds data within "screenshots" rather than overwriting the whole document. I have a suspicion I may need to use XPath too, but I have no idea how!
The code I have pieced together from online examples looks like this (but I(m certain it(s wrong)
$newshottitle = "My new screenshot";
$newshotlink = "http://www.image.com/image.jpg";
$dom = newDomDocument;
$dom->formatOutput = true;
$t = $dom->createElement("item");
$t = $dom->createElement("title");
$l = $dom->createElement("link");
posted date: 2009-04-07 10:54:00