duanruinong0619 2013-04-02 18:11
浏览 33

无效格式xml的最佳PHP解析器[重复]

This question already has an answer here:

Whats the best xml parser to use especially for XML that's technically invalid format with the <?xml tag missing?

I cant use simpleXML because that gives a error for being invalid. I know i can manually add the tags I need after i get the xml but id prefer to see what you guys think is the best method for parsing a xml into an array in php.

</div>
  • 写回答

2条回答 默认 最新

  • dtl85148 2013-04-02 18:16
    关注

    You can use SimpleXML and disable errors by using libxml_use_internal_errors(false);. In case SimpleXML simply won't use your string, I've personally used DOM to parse/fix broken XML before.

    On the other hand, why don't you simply add the <?xml characters before reading it?

    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口