[英]escape special character in xml
我在以下xml文件中運行此查詢:
<?xml version="1.0" encoding="UTF-8"?>
..
...
<query>
update tableX set colName='$ClassService.getParameter(\"param1\")$' where id = '0'
</query>
...
我收到以下錯誤:
ERROR]:發生異常,終止。 java.lang.IllegalArgumentException:異常解析或評估ClassService.getParameter(\\“param1 \\”)
如何逃脫“正確?
那么只使用CDATA部分呢?
<![CDATA[
Within this Character Data block I can
use double dashes as much as I want (along with <, &, ', and ")
*and* %MyParamEntity; will be expanded to the text
"Has been expanded" ... however, I can't use
the CEND sequence (if I need to use it I must escape one of the
brackets or the greater-than sign).
]]>
或者這不符合您的要求?
所以它看起來類似於:
<?xml version="1.0" encoding="UTF-8"?>
..
...
<query>
<![CDATA[
update tableX set colName='$ClassService.getParameter(\"param1\")$' where id = '0'
]]>
</query>
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.