Hello,
maybe it exists other solutions, but in such I am using the
following 2 step code:
<xmltask source="${tomcat.home}/conf/server.xml">
<copy
path="boolean(/Server/Service/Engine/Host/conte...@path='/doceng'])"
property="is.path.available" />
</xmltask>
<if> (this if task is from antcontrib)
<isfalse value="${is.path.available}"/>
<then>
....your insert....
</then>
</if>
-----Original Message-----
From: Cool The Breezer [mailto:[email protected]]
Sent: Monday, May 04, 2009 11:02 AM
To: [email protected]
Subject: [Xmltask-users] Conditional insert based on xpath
Hi,
I am currently using <insert> task for deploying my webapp. However
sometimes, the context is inserted more than once and I have to perform
conditional insert in target. Before inserting, I have to check whether
path="/Server/Service/Engine/Host/conte...@path='/doceng'] exists or
not. If exists then dont insert otherwise insert. I was looking into
"if" subtask but could not able to find any examples. Please find my
code below and would appreciate your help.
<target name="deploy_local">
<echo message="(INFO): Please ensure that server is
down, while deploying to localhost"/>
<xmltask source="${tomcat.home}/conf/server.xml"
dest="${tomcat.home}/conf/server.xml">
<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="${driverclassName}"
url="${dburl}"
username="${dbusername}"
password="${dbpassword}"
maxActive="${maxactive}"
maxIdle="${maxidle}"
maxWait="${maxwait}"/>
</Context>
]]>
</insert>
</xmltask>
</target>
------------------------------------------------------------------------
------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Xmltask-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmltask-users
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Xmltask-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmltask-users