dqw7121 2011-03-31 05:06
浏览 33
已采纳

XML解析_处理异常......基本的PHP问题

I have written a perfectly working XML parser using PHP... using,

$xml = simplexml_load_file($newfile);

Now, The newfile was a pointer to an xml file that has over 20000 lines.
The problem was, the system ( an android) started generating tags called

< none >

... when no value existed... BUT, there is NO < /none > tag ... There are multiple < none > values !! It seems like
a) Either instruct Android not to do this ! - TRIED, but it can't be controlled .. OS deals with it.

b) or, Create a PHP loophole to prevent this error !

I need help. How do I achieve this ?

Thanks

  • 写回答

1条回答 默认 最新

  • doumengyin0491 2011-03-31 05:52
    关注

    If there no end tag - xml is not valid. If there only issue with none tag you can try ignore it in your parser. Or even try remove none tags with php "find and replace" functions like preg_replace before dealing with parser

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应