You can specify the same source and destination i.e build_status.xml.cp,
and XMLTask will load the file, modify it and then write it back.
Neha Bhambhani wrote:
Per new requirement, I'm using xmltask to read deployfile.xml to get
owner of project/projectname. I need to write into build status xml
file which gets generated during our build. When running the following
code, it needs to add new child (projectowner) in build status xml
file, but this adds project owner for the last project only as I'm
using the same dest file in xmltask during the xmltask-insert for each
project. Is there a way to update build_status.xml.cp for each project
using xmltask? Please assist!
The below code is to read xml file and call ant task -
update_bld_status to update build_status file
<xmltask source="deployfile.xml">
<call
path="/applicatio...@group='xyz']/application/profile"
target="update_bld_status">
<param name="projectOwner" path="@projectowner"/>
<param name="projectName" path="@projectname"/>
</call>
</xmltask>
<target name="update_bld_status">
<if>
<available file="build_status.xml" type="file"/>
<then>
<property name="addNewElement"
value="<projectowner>${projectOwner}</projectowner>"/>
<property name="nameProject" value="${projectName}.jpr"/>
<echo message="projectowner : ${addNewElement}"/>
<echo message="projectname : ${projectName}"/>
<echo message="nameProject : ${nameProject}"/>
<xmltask source="build_status.xml"
dest="build_status.xml.cp">
<insert
path="/log/deploy-task/target/project[text()='${nameProject}']"
xml="${addNewElement}" position="after"/>
</xmltask>
</then>
</if>
</target>
after running the above code, build status gets updated as below
(build_status.xml):
<log>
<deploy-task>
<target>
<profile>Model-Test</profile>
<workspace>Test.jws</workspace>
<project>Model-Test.jpr</project>
</target>
<status exitcode="0">SUCCESS</status>
</deploy-task>
<deploy-task>
<target>
<profile>View-Test</profile>
<workspace>Test.jws</workspace>
<project>ViewController-Test.jpr</project>
<projectowner>x...@yahoo.com</projectowner>
</target>
<status exitcode="0">SUCCESS</status>
</deploy-task>
<log>
thanks in advance!
------------------------------------------------------------------------
------------------------------------------------------------------------------
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
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
------------------------------------------------------------------------------
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
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users