使用ant脚本将文件中的标记替换为其他文件的内容

时间:2013-10-23 04:31:51

标签: ant

我有2个文件输入文件和替换文件。我想用输入文件的所有内容替换输入文件中的标记(@@CONTENT_TO_REPLACE@@)。

输入文件:     

<amxdata_base:Enterprise
    xmlns:amxdata="http://tibco.com/amxadministrator/command/line/types"
    xmlns:amxdata_base="http://tibco.com/amxadministrator/command/line/types_base"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

    <!-- Enterprise level Substitution variables -->

    @@CONTENT_TO_REPLACE@@

</amxdata_base:Enterprise>

替换文件:

<SVar xsi:type="amxdata_base:SubstitutionVariable" name="JMS_CONNECTION_TOPIC_FACTORY" type="String" value="@SVAR_ENT_JMS_CONNECTION_TOPIC_FACTORY@" /> 
<SVar xsi:type="amxdata_base:SubstitutionVariable" name="JMS_CONNECTION_QUEUE_FACTORY" type="String" value="@SVAR_ENT_JMS_CONNECTION_QUEUE_FACTORY@" /> 

Resulant文件:

<amxdata_base:Enterprise
    xmlns:amxdata="http://tibco.com/amxadministrator/command/line/types"
    xmlns:amxdata_base="http://tibco.com/amxadministrator/command/line/types_base"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

    <!-- Enterprise level Substitution variables -->

    <SVar xsi:type="amxdata_base:SubstitutionVariable" name="JMS_CONNECTION_TOPIC_FACTORY" type="String" value="@SVAR_ENT_JMS_CONNECTION_TOPIC_FACTORY@" /> 
    <SVar xsi:type="amxdata_base:SubstitutionVariable" name="JMS_CONNECTION_QUEUE_FACTORY" type="String" value="@SVAR_ENT_JMS_CONNECTION_QUEUE_FACTORY@" /> 

</amxdata_base:Enterprise>

0 个答案:

没有答案