Re: [Xmltask-users] how to Control the data to be rewritten into destination file on multiple runs
Brought to you by:
bagnew
From: Brian A. <br...@oo...> - 2009-06-05 17:35:50
|
Please reply to the list, not me, so everyone can see this. Something like: <target name="...."> <copy path="web/servlet/context/root[@id='2']/text()" property="property1"/> </target> <target name="...."> <insert if="property1"> On reflection this may not matter. Ant will expand properties on the initialisation of each target (I think), so setting a property then reading it in one target may cause problems. I'm not sure if it matters in this case. Brian On 5/6/09 18:29, Adithya V.S.S wrote: > HI Brian, > Thank you for the quick reply, > Please help me understand. I couldnt make out "Note that you should > set the property in one <target> and read it via another (due to how > Ant works). " > thanks > adi > > > On Fri, Jun 5, 2009 at 6:58 PM, Brian Agnew <br...@oo... > <mailto:br...@oo...>> wrote: > > Well, I normally recommend reading one XML file and writing to > another, so this doesn't occur. But you can copy from nodes into a > property, and only execute <insert>s etc. if a property is > set/unset, so that should get you going. Note that you should set > the property in one <target> and read it via another (due to how > Ant works). > > > On 4/6/09 21:45, Adithya V.S.S wrote: >> >> Hi, >> I have a small query in xml task , my example is -- >> My source file from where i read the properties is like this - >> >> 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 is --- >> --------------------------- >> <?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/" 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> >> >> <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" > >> <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}" /> >> </category> ]]> >> </insert> >> </xmltask> >> </target> >> When I run my build.xml file is run it adds all the properties >> from the build-configuration xml to the workshopLogCfg.xml file, >> so far so good.. when I run the same build.xml file then it >> writes the data again.. ( no change in the build-configuration >> .xml ) , instead i dont want the same data to be re-written every >> time to workshopLogCfg.xml. >> Is there a way to control this ? Something like -- <insert > only >> when doesnt exist, else just update the same entries with the old >> entries... >> Any idea will be so great... >> thanks >> adi >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------------ >> OpenSolaris 2009.06 is a cutting edge operating system for enterprises >> looking to deploy the next generation of Solaris that includes the latest >> innovations from Sun and the OpenSource community. Download a copy and >> enjoy capabilities such as Networking, Storage and Virtualization. >> Go to:http://p.sf.net/sfu/opensolaris-get >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Xmltask-users mailing list >> Xml...@li... <mailto:Xml...@li...> >> https://lists.sourceforge.net/lists/listinfo/xmltask-users >> > > -- > Brian Agnewhttp://www.oopsconsultancy.com <http://www.oopsconsultancy.com/> > OOPS Consultancy Ltd > Tel: +44 (0)7720 397526 > Fax: +44 (0)20 8682 0012 > > > > > > -- > Adithya V.S.S -- Brian Agnew http://www.oopsconsultancy.com OOPS Consultancy Ltd Tel: +44 (0)7720 397526 Fax: +44 (0)20 8682 0012 |