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从入门到精通源码 eclipse自动运行浏览器 数组求助? 突然发现有两颗星星了,散分! 怎样编辑信件的时候用html源码,发信的时候就是页面的那种形式 奇怪的cookie问题,有时有,有时无 JS怎样调用PHP 取得以上动态数据??? 唠叨请看一下 解决中文哪!求援! 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();