ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Agnew <brianag...@yahoo.com>
Subject Re: replacing text in a file during a copy
Date Thu, 21 Nov 2002 20:25:12 GMT
You can also use <xmltask> and its <insert> command to do the same.

eg.
<xmltask source="input.xml" dest="output.xml>
   <insert path="/web/" file="webinc.xml" position="under"/>
</xmltask>

or similar, depending on your requirements. More at
http://www.oopsconsultancy.com/software/xmltask.html

Brian

 --- Magesh Umasankar <umagesh@apache.org> wrote: > Typos in both cases:
> 
> Try:
> 
>  <target    name="merge-descriptor-2">
>   <loadfile property="webinc.xml" srcFile="webinc.xml"/>
>   <copy file="web.xml" toFile="dist/web.xml">
>     <filterset>
>       <filter token="WEBINC" value="${webinc.xml}"/>
>     </filterset>
>   </copy>
>  </target>
> 
> Try:
> 
>  <target    name="merge-descriptor-3">
>   <loadfile property="webinc.xml" srcFile="webinc.xml"/>
>   <loadfile property="web.xml" srcFile="web.xml">
>       <filterchain>
>          <replacetokens>
>             <token key="WEBINC" value="${webinc.xml}"/>
>          </replacetokens>
>       </filterchain>
>   </loadfile>
>   <echo message="${web.xml}" file="dist/web.xml"/>
>  </target>
> 
> or
> 
>  <target    name="merge-descriptor-3">
>   <loadfile property="webinc.xml" srcFile="webinc.xml"/>
>   <copy file="web.xml" toFile="dist/web.xml">
>       <filterchain>
>          <replacetokens>
>             <token key="WEBINC" value="${webinc.xml}"/>
>          </replacetokens>
>       </filterchain>
>   </loadfile>
>  </target>
> 
> 
> Cheers,
> Magesh
> 
> ----- Original Message -----
> From: "Kevin HaleBoyes" <kzboyes@yahoo.com>
> To: <ant-user@jakarta.apache.org>
> Sent: Thursday, November 21, 2002 2:06 PM
> Subject: replacing text in a file during a copy
> 
> 
> > I have a web application deployment descriptor web.xml in a file.
> > I've run the JspC task with the -webinc arguement which creates a
> > portion of the deployment descriptor (webinc.xml) for the JSP
> > mappings.
> >
> > I need to merge the webinc.xml file into the web.xml file when
> > I build my project.
> >
> > I've tried the <loadfile> task with a <filterchain> which didn't
> > work.  I've also tried the <copy> task with a <filterset> but that
> > also didn't work.
> >
> > Specifically, I have a token in the web.xml
> > file marked @WEBINC@ and the following target:
> >
> > <target    name="merge-descriptor-2">
> >  <loadfile property="webinc.xml" srcFile="webinc.xml"/>
> >  <copy file="web.xml" toFile="dist/web.xml">
> >    <filterset>
> >      <filter token="WEBINC" value="${webinc.xml}/>
> >    </filterset>
> >  </copy>
> > </target>
> >
> > but this results in the following error message:
> > file:/home/hb/Work/cml/tmp/build.xml:43: The value of attribute
> > "value" must not contain the '<' character.
> >
> > So I tried this target...
> >
> > <target    name="merge-descriptor-3">
> >  <loadfile property="webinc.xml" srcFile="webinc.xml"/>
> >  <loadfile property="web.xml" srcFile="web.xml">
> >      <filterchain>
> >         <replacetokens>
> >            <token key="WEBINC" value="${webinc.xml}"/>
> >         </replacetokens>
> >      </filterchain>
> >  </loadfile>
> >  <echo message="${web.xml}" file="dist/web.xml">
> > </target>
> >
> > and I get the same error.
> >
> >
> > How can I perform this merge?
> > Thanks,
> > Kevin.
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> > http://mailplus.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>  

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

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message