Advise sought on handling XML in PHP

VivianPotthaste

New Member
I'm creating a Wordpress plugin that handles feeds provided by affiliate marketing companies.The content will come in either CSV or XML formatThe problem is that there is no standard between the different companies so they will come with different keys, headers and content.When parsing CSV I used Kazuyoshi Tlacaelel's CSV ParserWhich is a clean, easy way to parse CSV files:\[code\]$csv = new File_CSV_DataSource;$csv->load($file);$csv->countRows();$csv->getHeaders();$csv->getrawArray();\[/code\]Most importantly it is totally agnostic to differing headers and rowsI was looking at using SimpleXML for parsing XML but as the tags will vary from one source to another it doesn't seem a viable solution.Looking at another Wordpress plugin that handles affiliate feeds I see that they convert their XML files to CSV before parsing the content.What solution would you implement for this problem?
 
Back
Top