FredPenner Posted August 18, 2011 Share Posted August 18, 2011 What is the best approach to merge/join XML data via PHP? File#1: <users> <user> <name>Mark</name> <id>100</id> </user> <user> <name>Fred</name> <id>100</id> </user> </users> File#2: <users> <user> <id>100</id> <lat>50</lat> <lon>122</lon> </user> </users> Desired output (only keep records where a match is found): <users> <user> <id>100</id> <lat>50</lat> <lon>122</lon> <name>Mark</name> </user> </users> Thanks in advance! M Link to comment https://forums.phpfreaks.com/topic/245137-how-to-join-xml-data-based-on-an-id/ Share on other sites More sharing options...
synking Posted August 18, 2011 Share Posted August 18, 2011 I have not used much xml and php but simplexml might be what you need. As it can create an array out of the xml tags and you can use the array to step through the data you need. But not sure as it looks here you are tryin to compare two xml files and match them up with what is found in each. edit: for got the link http://php.net/manual/en/book.simplexml.php Link to comment https://forums.phpfreaks.com/topic/245137-how-to-join-xml-data-based-on-an-id/#findComment-1259113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.