php 如何处理非标准XML?

kuangzi007 2009-06-04 05:59:01
现有一个XML文件,是截取的用户POST的一封163邮件,内容如下:
<?xml version="1.0"?><object><string name="action">deliver</string><string name="id">vBeXiLVVkVBnaSCcOmVVEwHQESYUEKHV</string><object name="attrs"><string name="account">"programtest" <programtest@163.com></string><array name="to"><string>"programtest" <programtest@163.com></string></array><array name="cc"/><array name="bcc"/><string name="subject">Fw:!@#!$#@^$&%*%%:<">?>"<:"L">?>>(*&(*&(</string><string name="content"><DIV> </DIV>
<DIV> </DIV>---------- 转发邮件信息 ----------<BR>发件人:"programtest <programtest@163.com>" <BR>发送日期:2009-06-03 18:11:08<BR>收件人:programtest <programtest@163.com><BR>主题: !@#!$#@^$&%*%%:<">?>"<:"L">?>>(*&(*&(<BR>
<DIV>搜狐<A href="http://auto.sohu.com/" target=_blank><FONT color=#000099>汽车</FONT></A>讯 据美国有线电视新闻网(CNN)6月2日报道,<A href="http://jsp.auto.sohu.com/view/group-gid-240.html" target=_blank><FONT color=#000099>通用汽车</FONT></A>公司(General Motors Corp)就出售旗下<A href="http://db.auto.sohu.com/brandQuery_174_1.html" target=_blank><FONT color=#000099>悍马</FONT></A>(<A href="http://db.auto.sohu.com/brandQuery_174_1.html" target=_blank><FONT color=#000099>Hummer</FONT></A>)品牌已经与买方达成协议。<A class=teshu href="http://jsp.auto.sohu.com/view/group-gid-240.html" target=_blank><FONT color=#000099>通用汽车</FONT></A>公司证实<A class=teshu href="http://db.auto.sohu.com/brandQuery_174_1.html" target=_blank><FONT color=#000099>悍马</FONT></A>买家为一家中国企业——总部位于成都的四川腾中重工机械有限公司(Sichuan Tengzhong Heavy Industrial Machinery Company Ltd.)。
<P>  1999年,<A class=teshu href="http://jsp.auto.sohu.com/view/group-gid-240.html" target=_blank><FONT color=#000099>通用汽车</FONT></A>收购了<A class=teshu href="http://db.auto.sohu.com/brandQuery_174_1.html" target=_blank><FONT color=#000099>悍马</FONT></A>品牌的所有权。作为一家民营企业,腾中重工机械有限公司表示,计划保留<A class=teshu href="http://db.auto.sohu.com/brandQuery_174_1.html" target=_blank><FONT color=#000099>悍马</FONT></A>的管理团队。腾中重工总经理杨毅表示,“在当前管<BR>><BR>:L<BR>><BR>>":>"L:<BR>:<BR>"?>">?<"<"L":>":>>":<":L":"<_)(*_(<A href="mailto:*&*%&^$#%@!#$@%E&*T*((Y">*&*%&^$#%@!#$@%E&*T*((Y</A>()*)(*_)&&&&&&&&&&&理团队的领导下,<A class=teshu href="http://db.auto.sohu.com/brandQuery_174_1.html" target=_blank><FONT color=#000099>悍马</FONT></A>品牌将以全新的方式不断创新和增长。我们计划对<A class=teshu href="http://db.auto.sohu.com/brandQuery_174_1.html" target=_blank><FONT color=#000099>悍马</FONT></A>品牌和产品研发能力投入资源,从而满足美国和全球市场对如高燃油效率的新产品的需求。”腾中重工表示,此交易将于今年九月底完成交割。</P></DIV><BR><BR><SPAN title=neteasefooter>
<HR>
<A href="http://qiye.163.com/?ft=3">网易企业邮,商务邮箱专家</A> </SPAN></string><boolean name="isHtml">true</boolean><int name="priority">3</int><boolean name="saveSentCopy">true</boolean><boolean name="requestReadReceipt">false</boolean><string name="charset">gbk</string><string name="id">vBeXiLVVkVBnaSCcOmVVEwHQESYUEKHV</string></object><int name="saveSentLimit">1</int></object>
如何用php,来处理该XML文件?
...全文
80 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
kuangzi007 2009-06-18
  • 打赏
  • 举报
回复
首先谢谢大家,因为我要解析里面的数据然后处理,大家的方法都试过了,不好使。我把他当成字符串处理了。
分就平分给大家喽。thanks。
tfxg 2009-06-08
  • 打赏
  • 举报
回复
先弄成標準的XML或者自由火說的HTML,沒有標準不成方圓
海诗美妆 2009-06-08
  • 打赏
  • 举报
回复
直接用simplexml就可以了。
fxs_2008 2009-06-08
  • 打赏
  • 举报
回复
不是xml的,就当html 解析

xml是严格按标准的,否则不叫xml
程序猿之殇 2009-06-05
  • 打赏
  • 举报
回复
本身就不是标准的xml,所以转换肯定是不太现实的.
直接当做html来解析吧.
用tidy_function
ruanchao 2009-06-04
  • 打赏
  • 举报
回复
simplexml试一试。。。
wang_quan_li 2009-06-04
  • 打赏
  • 举报
回复
使用HTML转换为XHTML的开源工具HTML Tidy

20,396

社区成员

发帖
与我相关
我的任务
社区描述
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
phpphpstorm 技术论坛(原bbs)
社区管理员
  • 开源资源社区
  • phpstory
  • xuzuning
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧