See the property task http://ant.apache.org/manual/CoreTasks/property.html

and then reference within your XML using standard Ant format e.g. 
${propertyName}. Note that you may have to use the <property> task in 
one target, and the <xmltask> within another target, due to how/when Ant 
expands the properties.

On 16/4/09 12:57, Cool The Breezer wrote:
> Hi,
>    Thanks Brian for your help to my earlier mail in ant user list.
> I want some advanced stuff on replacing dynamic text with literals while 
> inserting to target tag in xml.
>
> E.g.
> <!-- Deploys to local server -->
>       <target name="deploy_local">
>               <echo message="${tomcat.home}"/>
>               <xmltask source="${tomcat.home}/conf/server.xml" 
> dest="${tomcat.home}/conf/1.xml" report="true">
>                       <insert path="/Server/Service/Engine/Host/text()[1]" 
> position="before">
>                               <![CDATA[
>                                       <Context path="/doceng" 
> reloadable="true" docBase="@docbase">
>                       <Resource name="jdbc/docengdb" auth="Container"
>                                     type="javax.sql.DataSource" 
> driverClassName="oracle.jdbc.driver.OracleDriver"
>                                     url="@dburl"
>                                     username="@username" password="@password" 
> maxActive="20" maxIdle="10"
>                                     maxWait="-1"/>
>                                       </Context>
>                               ]]>
>                       </insert>
>               </xmltask>
>       </target>
>
> I want to replace @docbase,@dburl,@username etc... with actual value from 
> property file before inserting into target XML.
>
> Please suggest me how to do it.
>
> - RB
>
>
>
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Xmltask-users mailing list
> Xmltask-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xmltask-users
>    

-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to