raaks Posted November 22, 2011 Share Posted November 22, 2011 I have been playing with XML and PHP, I have googled to get the requirement which I am working on but still Im not getting the things the way I wanted. I have got a XML file with nested variables, I need to parse the variables such as user_id, name and store it in an array, so that I need to use them to change the details in another config file. For ex: if the user is logged in, using the user_id, i need to parse the all the data of the particular user from the XML file (where the details of the various users are stored). Until now I could only parse the data and echo all of it but could not find a way to store this parsed information. This is my "test.xml" file: <?xml version="1.0" encoding="ISO-8859-1"?> <document> <user> <user_id>0121</user_id> <name>Tim</name> <file>0121.file</file> </user> <user> <user_id>0178</user_id> <name>Henry</name> <file>0178.file</file> </user> <user> <user_id>0786</user_id> <name>Martin</name> <file>0786.file</file> </user> <user> <user_id>1239</user_id> <name>Jan</name> <file>1239.file</file> </user> </document> Any valuable information would be greatly helpful Thanks Raaks Quote Link to comment https://forums.phpfreaks.com/topic/251608-parse-the-nested-variables-in-xml-using-php/ Share on other sites More sharing options...
ManiacDan Posted November 22, 2011 Share Posted November 22, 2011 You said you could already parse it, give us the code you're using to parse the file. Quote Link to comment https://forums.phpfreaks.com/topic/251608-parse-the-nested-variables-in-xml-using-php/#findComment-1290397 Share on other sites More sharing options...
raaks Posted November 23, 2011 Author Share Posted November 23, 2011 Hi, thanks for the reply. You were right, there were some minor errors in my code and now it works. Quote Link to comment https://forums.phpfreaks.com/topic/251608-parse-the-nested-variables-in-xml-using-php/#findComment-1290693 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.