ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <sbaill...@imediation.com>
Subject [PROPOSAL] XPath task
Date Mon, 23 Apr 2001 15:22:26 GMT

Following discussion w/ Scott and Jeff in alexandria-dev, I quickly wrote an
XPath task.

I'm not sure this is 'exactly' how it should be done...
this looks like more a feature of the replace task, but I also wanted the
multiple replace feature without parsing n times the xml document.

Use at as follows:

<xpath file="input.xml" tofile="output.xml">
	<apply select="/root/node/@attribute" value="newvalue"/>
	<apply select="/root/node/child/@attribute" value="newvalue"/>
</xpath>

or simply:

<xpath file="input.xml" select="/root/node/@attribute" value="newvalue"/>

So here is the XPath task, with testcase and doc.

I used the package org.apache.tools.ant.taskdefs.optional.xpath
Feel free to change it to a more appropriate one (for instance if it is to
be used in cjan or alexandria).

Cheers,

-- 
 St├ęphane Bailliez 
 Software Engineer, Paris - France 
 iMediation - http://www.imediation.com 
 Disclaimer: All the opinions expressed above are mine and not those from my
company. 



Mime
View raw message