PHP 加载XML文件问题 我用的版本是5.0,发现PHP在加载XML文件时,会自动把回车符替换成空格,请问这是怎么回事,该怎么规避? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是指标签内部的换行被替换了吗?应该不会的,除非你定义了DTD,loadXML的时候第二参数有设置吗?或者是你的其他代码替换了。能不能把你的XML字符串和代码贴出来看看 XML文件信息:<?xml version="1.0" encoding="UTF-8"?><StatusInfo taskid="atpjfea3ol6"> <sum>1</sum> <executed>1</executed> <passed>0</passed> <status>finished</status> <prevcase uri="atpjfe9lb1n" result="Failed" memo="[MAT Stack] ConnMobile fail when connect to mobile 8613907550004[MAT Stack] Mobile 8613907550004 hasn't connected yet.[消息检查]检查失败:(8613907550004)接口没有(mobile_msg)消息" trace="" caselogpath="d:\iCAT\Root\AutoSpace\System\CasesLog\atpjfea3ol6\atpjfe9lb1n\log.xml"> <array type="arrayof_checkpoint"></array> </prevcase> <nextcase uri="" /></StatusInfo>$objDoc = new DOMDocument('1.0'); if (!$objDoc->loadXML($executeState)) { return array('ret' => -1); } $objDoc = new DOMDocument();$ret = $objDoc->load('F:\ExecuteStateInfo.xml');$executeState = $objDoc->saveXML(); 好像是自动转换的,为了XML处理提高效率,如果你保持的话建议在原XML中用\r\n代替直接换行,这样你在读出数据的时候可以保持换行的格式。 PHP学习问题! php.ini中设置display_errors=off后仍然有警告信息 怎样能够长时间运行php脚本? 怎么配置才可以输出php语言,谢谢!!! 数组问题 php判断msn在线状态 菜鸟问的关于流媒体的几个问题!!!! 网上购物的订单怎么存储 请问 urlencode()与rawurlencode()的区别 PHP与C的学习时间之比为多少? php获取中文cookie值 webservice NUSOAP 的问题。。
应该不会的,除非你定义了DTD,loadXML的时候第二参数有设置吗?
或者是你的其他代码替换了。能不能把你的XML字符串和代码贴出来看看
<?xml version="1.0" encoding="UTF-8"?>
<StatusInfo taskid="atpjfea3ol6">
<sum>1</sum>
<executed>1</executed>
<passed>0</passed>
<status>finished</status>
<prevcase uri="atpjfe9lb1n" result="Failed"
memo="[MAT Stack] ConnMobile fail when connect to mobile 8613907550004
[MAT Stack] Mobile 8613907550004 hasn't connected yet.
[消息检查]检查失败:(8613907550004)接口没有(mobile_msg)消息"
trace=""
caselogpath="d:\iCAT\Root\AutoSpace\System\CasesLog\atpjfea3ol6\atpjfe9lb1n\log.xml">
<array type="arrayof_checkpoint"></array>
</prevcase>
<nextcase uri="" />
</StatusInfo>
$objDoc = new DOMDocument('1.0');
if (!$objDoc->loadXML($executeState))
{
return array('ret' => -1);
}
$ret = $objDoc->load('F:\ExecuteStateInfo.xml');
$executeState = $objDoc->saveXML();