[Xmltask-users] Help Needed On XML Tasks
Brought to you by:
bagnew
From: Adithya V.S.S <ad...@gm...> - 2009-03-23 22:04:42
|
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" 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/builds[@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 |