Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Problem in ant replace task and replaceregexp task to update xml

Reply
Thread Tools

Re: Problem in ant replace task and replaceregexp task to update xml

 
 
Victor
Guest
Posts: n/a
 
      09-01-2004
Problem solved -- simply use the jakata ono with ant.


http://www.velocityreviews.com/forums/(E-Mail Removed) (Victor) wrote in message news:<(E-Mail Removed). com>...
> Dear all,
>
> I am having a problem in using the ant task replace to update the
> following xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE
> Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
> <application>
> <display-name>TestServer</display-name>
> <module>
> <ejb>EJB1.jar</ejb>
> </module>
> <module>
> <ejb>EJB2.jar</ejb>
> </module>
> <module>
> <ejb>EJB3.jar</ejb>
> </module>
> <module>
> <web>
> <web-uri>web.war</web-uri>
> <context-root>testme</context-root>
> </web>
> </module>
> </application>
>
> I just want to remove the Web module in the above xml, that is:
>
> ....
> <module>
> <web>
> <web-uri>web.war</web-uri>
> <context-root>testme</context-root>
> </web>
> </module>
> .....
>
> I have tried to use the replace task as following:
>
> <project name="ReplacementTest" default="test" basedir=".">
>
> <target name="test">
>
> <echo message="Going to remove the war module in the file
> now..."/>
>
> <replace file="c:\ant build\test\application.xml">
> <replacetoken><![CDATA[<module>
> <web>
> <web-uri>web.war</web-uri>
> <context-root>testme</context-root>
> </web>
> </module>]]>
> </replacetoken>
> <replacevalue>><![CDATA[ ]]></replacevalue>
>
> </replace>
>
> </target>
>
> </project>
>
> And it just doesn't work.
>
> At the same time, I also attempt to use the replaceregexp as
> following:
>
> <project name="ReplacementTest" default="test" basedir=".">
>
> <target name="test">
>
> <echo message="Going to remove the war module in the file
> now..."/>
>
> <replaceregexp file= "c:\ant build\test\application.xml" flags=
> "s" >
> <regexp pattern="(&lt;module&gt(&lt;web&gt(.*?)(&lt;/web&gt(&lt;/module&gt"
> />
> <substitution expression="" />
> </replaceregexp >
>
> </target>
>
> </project>
>
> And it keep giving me the " No supported regular expression matcher
> found" error.
>
> Could anyone give me a help on this?
>
> Thanks very much in advance!!!
>
> Victor

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing ant task name when running a task teggy Java 0 05-29-2007 02:20 PM
Maven using ANT plugin for SCP task : Embedded error: Could not create task or type of type: scp. krabhi Java 1 08-09-2006 04:19 PM
Ant replace task / casesensitivity jespersahner Java 0 07-26-2006 11:49 AM
anttask ReplaceRegExp and empty lines ogmios01@gmail.com Java 7 03-19-2006 07:15 PM
Replacing multiple occurrence of double/single quotes using Ant's replaceregexp Darpan Java 3 03-02-2005 04:27 AM



Advertisments