Welcome to DeadEd.com
Sunday, May 11 2008 @ 07:10 PM CDT

XMLTask

Information

xmltask provides the facility for automatically editing XML files as part of an Ant build. Unlike the standard filter task provided with Ant, it is XML-sensitive, but doesn't require you to define XSLTs.

Uses include:

  • modifying configuration files for applications during builds
  • inserting/removing information for J2EE deployment descriptors
  • dynamically building Ant build.xml files during builds
  • building and maintaining websites built with XHTML
  • driving Ant via a meta build.xml to abstract out build processes

Homepage: http://www.oopsconsultancy.com/software/xmltask/index.html

Example

There are 2 targets to help manipulate your XML files, one for replacing the text within an element and the other for replacing a value of an attribute ...

To use the xmltask.replace.text target, you need to set the properties described in the Common Build Targets document.

<target name="xmltask.replace.text"> <ant antfile="${common.build}" target="xmltask.replace.text"> <property name="xml.source" value="${application.xml.file}" /> <property name="xml.dest" value="${application.xml.file}" /> <property name="xml.xpath" value="application/description/text()" /> <property name="xml.replace.text" value="${version.id}" /> </ant> </target> To use the xmltask.attr.value target, you need to set the properties described in the Common Build Targets document. <target name="xmltask.attr.value"> <ant antfile="${common.build}" target="xmltask.attr.value"> <property name="xml.source" value="${ws.web.external.wsdl}" /> <property name="xml.dest" value="${ws.web.external.wsdl}" /> <property name="xml.xpath" value="wsdl:definitions/wsdl:service/wsdl:port/soap:address[@location]" /> <property name="xml.attr" value="location" /> <property name="xml.value" value="${port.url}" /> </ant> </target>


Last Updated Tuesday, January 24 2006 @ 04:45 AM CST; 1,642 Hits View Printable Version