OK - I must confess something here... I do a ton of XSLT work...and never knew you could just prefix with colon... That is nice to know!

On Thu, 19 Nov 2009, Brian Agnew wrote:

The colon means you're specifying a *local* name for the element - i.e.
independent of the namespacing in the document (which confuses matters
otherwise).

Brian


Hello,

thanks you for your answer.

I have a question : why do you use the « : » character to browse the XML
document (cf. path="//:project/:parent/:version/text()") in using the
XmlTask task ?

It seems that XPath language don't use this symbol.

Thanks a lot,
Fabien.






Jhoomsharabi-2 wrote:



Why don't you use xmltask by oopsconsultancy
http://www.oopsconsultancy.com/software/xmltask/

If you use xmltask your ant build.xml will look like this:

Say your pom.xml looks like this:

pom.xml
-------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>

    <parent>
        <version>0.0.0-SNAPSHOT</version>
    </parent>
</project>


So your build.xml will look like this

build.xml
---------
<project name="version-pick" default="read-replace">

 <taskdef name="xmltask"
            
classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
   
    <target name="read-replace">
        <xmltask source="${pom.path}/pom.xml"
dest="${pom.path}/pom.xml"
failWithoutMatch="true">
      <replace path="//:project/:parent/:version/text()"
            withText="1.2.00-SNAPSHOT"/>
        </xmltask>
    </target>
</project>



I will say if you use xmltask its easy and you can do lot more
operations
than you can expect.






parent




-----Original Message-----
From: Saberex <sabe...@gmx.net>
To: user@ant.apache.org
Sent: Mon, Jun 15, 2009 8:22 pm
Subject: replace version info in maven2 pom with ant




i to all,
I´ m trying to filter/replace a maven2 pom with=2
0ant.
o long not the biggest problem. One is my need to replace the <version>
/version> property.
o far just a small problem. I only have to replace the version which is
nside the <parent> </parent> declaration.
<loadfile srcFile="pom.xml" property="test.pom">
filterchain>
   <tokenfilter>
        <replaceregex pattern="*-SNAPSHOT" replace="versionIwant"
flags="gi"/>
   </tokenfilter>
/filterchain>
Seems not to fit 100%. I would replace all found regex.
Looking ahead for your replys
Saberex
-
iew this message in context:
http://www.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p24035984.html
ent from the Ant - Users mailing list archive at Nabble.com.

--------------------------------------------------------------------
o unsubscribe, e-mail: user-unsubscr...@ant.apache.org
or additional commands, e-mail: user-h...@ant.apache.org




--
View this message in context:
http://old.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p26421350.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org




--
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to