[英]escape special character in xml
I run this query in the following xml file: 我在以下xml文件中运行此查询:
<?xml version="1.0" encoding="UTF-8"?>
..
...
<query>
update tableX set colName='$ClassService.getParameter(\"param1\")$' where id = '0'
</query>
...
I get the following error: 我收到以下错误:
ERROR]: Exception occurred, terminating.
ERROR]:发生异常,终止。 java.lang.IllegalArgumentException: Exception parsing or evaluating ClassService.getParameter(\\"param1\\")
java.lang.IllegalArgumentException:异常解析或评估ClassService.getParameter(\\“param1 \\”)
How to escape " correctly? 如何逃脱“正确?
What about just use a CDATA-section for this? 那么只使用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).
]]>
Or does this not fit your requirement? 或者这不符合您的要求?
So that it will look similar to this: 所以它看起来类似于:
<?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.