<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
...
我想删除使用ant脚本,所有doctype
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
我成功删除<!DOCTYPE
使用:
&LT;
replaceregexp >
<regexp pattern="<DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >"/>
<substitution expression=""/>
<fileset file="${subproject.build.pre-dist.dir}/WEB-INF/struts-config.xml">
</fileset>
</replaceregexp>
如何删除所有内容?
答案 0 :(得分:0)
我尝试了这个解决方案:
<target name="test" depends ="init">
<loadfile
srcfile="${subproject.build.pre-dist.dir}/WEB-INF/struts-config.xml"
property="src.file.head1">
<filterchain>
<headfilter lines="-1" skip="3"/>
</filterchain>
</loadfile>
<echo file ="${subproject.build.pre-dist.dir}/WEB-INF/struts-config.xml"
message="<?xml version="1.0" encoding="UTF-8"?>
${src.file.head1}"/>
</target>