Page 1 of 1

PHP - Editing XML documents with simplexml

PostPosted: Sat Jul 02, 2011 5:54 pm
by ampakine
I've been playing around with the simplexml functions in PHP and I'm trying to get the addChild() function to add a new child element to an existing XML document and although I can echo the contents of this new element after I create it, the actual XML document doesn't get modified. Does the addChild() function not actually write to the XML file? In other words do I have to write the changes to the file myself with fwrite?

Re: PHP - Editing XML documents with simplexml

PostPosted: Sat Jul 02, 2011 6:42 pm
by fashizzlepop
I would assume you read the file into memory and then alter it. Thus, any changes you make are not changed with the file and you would then need to export it.