I would use simplexml. I go out on a limb and assume that if you have an XML writer, you also have a simplex.
Let's see, to add a node, let's say a very simple (get it?) Xml file:
<desserts>
<cakes>
<cake>chocolate</cake>
<cake>birthday</cake>
</cakes>
<pies>
<pie>apple</pie>
<pie>lemon</pie>
</pies>
</desserts>
If this is a file and you want to add a new pie, you should:
$desserts = new SimpleXMLElement;
$desserts->loadfile("desserts.xml");
$desserts->pies->addChild("pie","pecan");
Of course, this can be a lot more complicated than that. But as soon as you receive it, it is very useful.