Zipp425 Posted September 12, 2006 Share Posted September 12, 2006 Ive been working on a way to edit an xml file, I have been using fopen and just specifying a specific line to replace, but that wasnt working very well, because sometimes lines seemed to be off, or users would give data that would cause line breaks.I just recently learned about SimpleXML in PHP5, and I was wondering if someone could explain to me how I could use PHP to open a XML file, and select a specific tag name and replace a specific attribute, or a array of attributes.I would be using xmlHttpRequest to pass data to the PHP file that would then open and edit the XML file.Thanks for your help in advance Quote Link to comment Share on other sites More sharing options...
Barand Posted September 12, 2006 Share Posted September 12, 2006 see example 7http://www.php.net/manual/en/ref.simplexml.php Quote Link to comment Share on other sites More sharing options...
Zipp425 Posted September 12, 2006 Author Share Posted September 12, 2006 Beautiful. Thank you very much.Now, do you know if there is a way to make it so it will only create the new file once, and later just edit the created file?I would like to have one standard XML file that is then editted by user select and saved to a different XML file according to their useridIE[code]standard.xml--User Changes default settings---new attributes saved as userid.xml----User changes more settings-----edit attributes in userid.xml[/code]Nevermind, unless im wrong it looks like you can specify a file to write to with asXML()Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.