xml中的实体引用

it2026-05-12  3

今天在ant中需要执行nohup command & 时,出现错误:在实体引用中,实体名称必须紧跟在'&'后面

谷歌一下

实体引用是指分析文档时会被字符数据取代的置标。XML预先定义了5个实体引用,

&lt;   <   小于

&gt;  >   大于

&amp; &   与

&apos;   '   单引号

&quot;   "   双引号

 

如果你把字符 这些放在 XML 元素中,会发生错误,这是因为解析器会把它当作新元素的开始。

所以

<target name="runrsf" depends="scpf"> <sshexec host="${rhost}" username="${ruser}" password="${rpass}" trust="true" command="cd ${rdir} &amp;&amp;chmod 755 run.sh&amp;&amp;nohup bash ${rdir}/run.sh&amp;" timeout="10000" /> </target>

 

转载于:https://www.cnblogs.com/byleaf/p/4393626.html

最新回复(0)