SAX doesn't allow you to enter information into an XML document, but DOM does. And if you want to see the changed in the file, then you have to write it back out once you've finished changing it. The specific function to get an XML file back from a DOM object is domxml_dumpmem().