-----Original Message----- From: ca_iancu [mailto:[EMAIL PROTECTED] Sent: Friday, October 10, 2008 2:11 AM To: user@ant.apache.org Subject: Re: how to copy and edit a section of a text file
/* No, I mean copy the entire section as written down before: from <device name .... to </device>. I keep the old section, then I append the new one which is almost identical but not quite. If you look again at the code, you will see that the second xml file (the one I would like to get) is different than the first one. Here's another attempt, where device1 is duplicated and it becomes device2.They are independent entities now. Thank you. */ Sorry for the late reponse, had been off some days. Here a quick shot with xmltask = <project name="test" default="main" basedir="."> <!-- // Taskdefs --> <!-- Import XMLTask --> <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" /> <!-- Taskdefs // --> <!-- // Properties --> <property name="old.source.device" value="some_device"/> <property name="new.source.device" value="some_other_device"/> <!-- Properties // --> <target name="depends"> <xmltask source="File.xml" report="true" dest="File.xml"> <copy path="//[EMAIL PROTECTED]'${old.source.device}']/." buffer="foobar" /> <insert path="//[EMAIL PROTECTED]'some_device']/." buffer="foobar" position="after"/> <replace path="//[EMAIL PROTECTED]'${old.source.device}'][2]/@name" withText="${new.source.device}" /> </xmltask> </target> <target name="main" depends="depends"> <xmltask> <print buffer="foobar"/> </xmltask> </target> </project> Regards, Gilbert --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]