dspows0637 2012-05-07 10:09
浏览 35

建议在PHP中处理XML

I'm creating a Wordpress plugin that handles feeds provided by affiliate marketing companies.

The content will come in either CSV or XML format

The 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 Parser

Which is a clean, easy way to parse CSV files:

$csv = new File_CSV_DataSource;

$csv->load($file);

$csv->countRows();

$csv->getHeaders();

$csv->getrawArray();

Most importantly it is totally agnostic to differing headers and rows

I 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?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
    • ¥15 Python3.5 相关代码写作
    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动