I think you need something like:

<call path="/buildset/builds/" target="roottest">
<param name="name" path="testname/text()" />
<param name="appender1" path="build[1]/text()" />
<param name="appender2" path="build[2]/text()" />
<param name="appender3" path="build[3]/text()" />
</call>

2 things. 1) the parameter XPaths are relative to the node identified by <call>. 2) you can't easily pass a list as a parameter, hence the multiple further parameters.

Brian

On 23/3/09 22:04, Adithya V.S.S wrote:

I'm a newbie to the XML Tasks and I appreciate the help that I am getting from Brain, Thank you for the answers. I am doing some example , Stuck at only one point . Request you to help me out.. .
My build-configuration
===================
<buildset>
<builds testname="testing">
<testname>Category1</testname>
<build>development</build>
<build>systemtest</build>
<build>production</build>
</builds>
<builds testname="test">
<testname>Category2</testname>
<build>DEV</build>
<build>TEST</build>
<build>PROD</build>
</builds>
</buildset>
My build.xml file is like this -
---------------------------------------
<?xml version="1.0"?>
<project name="java.net <http://java.net>" default="main" basedir=".">
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath path="xmltask.classpath" />
</taskdef>

<target name="main" depends="testprg"/>
<property name="weblogic.home.cfgfile" value="C:/bea/weblogic81/common/lib/workshopLogCfg.xml" />

<target name="testprg">
<xmltask source="build-configuration.xml">
<call path="/buildset/builds/testname" target="roottest">
<param name="name" path="text()" />
<param name="appenders" path="/buildset/builds/build/text()" />
</call>

<call path="/buildset/buil...@testname]/build" target="compile-and-release">
<param name="build" path="text()"/>
</call>
</xmltask>
</target>



<target name="roottest" >
<echo>Building Category ${name}</echo>
<echo>Category Name ${appenders}</echo>

<echo>Appender ${appenders}</echo>
<xmltask source="${weblogic.home.cfgfile}" dest="${weblogic.home.cfgfile}" failWithoutMatch="true">

<insert path="/log4j:configuration/root" position="after">
<![CDATA[ <category name="${name}">
<priority value="debug" />
<appender-ref ref="${appenders}" /> // Here I should get multiple appenders.. for each build in each builds node </category> ]]> for eg: My Category Nodes should contain these appenders..
</insert>
Category1 Category2
<appender-ref ref="development"/> <appender-ref ref="DEV"/>
</xmltask> <appender-ref ref="systemtest"/> <appender-ref ref="TEST"/>
</target> <appender-ref ref="production"/> <appender-ref ref="TEST"/>



<target name="compile-and-release">
<echo>Building ${build}</echo>
<echo>${weblogic.home.cfgfile}</echo>

<xmltask source="${weblogic.home.cfgfile}" dest="${weblogic.home.cfgfile}" failWithoutMatch="true">

<insert path="/log4j:configuration/root" position="after">
<![CDATA[
<appender name="${build}" class="org.apache.log4j.RollingFileAppender">
<param name="File"   value="uan.log" />
<param name="Append" value="true" />
<param name="MaxFileSize" value="25000KB" />
<param name="MaxBackupIndex" value="5"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%t][%x]: %m%n"/>
</layout>
</appender>

        ]]>

</insert>
</xmltask>

</target>

</project>
When I run this build.xml it writes the above insert data into workshopLogCfg.xml, And when I see the xml file it has only one appender <appender-ref ref="PROD"/> ,
instead of three appenders as mentioned above for a builds node.
Can we manipulate this in XMLTask, also when I run the build .xml it creates duplicate entries.. Is there any way to escape from writing the same data into the xml on further runs.
any solution is greatly appreciated. ..

--
Adithya V.S.S
------------------------------------------------------------------------

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
------------------------------------------------------------------------

_______________________________________________
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

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to