Thanks Friends,
Charles I tried out your solution and found out the problem and a strange
phenomena. By default web.xml has a web-app element like this:

<web-app xmlns="http://java.sun.com/xml/ns/javaee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
    version="2.5">

And the example you sent me had just <web-app>. So if I change the above
web-app to just <web-app> everything works fine otherwise it totally ignores
it and do nothing.

Can someone please suggest anyway to resolve this?? This is strange.

Thanks


On 9/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I downloaded the xmltask-v1.15.1.jar file and placed it in the lib
> subdirectory of my ant installation.
>
> I prepared this web.xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app>
>    <mime-mapping>
>       <extension>html</extension>
>       <mime-type>text/html</mime-type>
>    </mime-mapping>
> </web-app>
>
> I prepared this insert.xml file:
>
> <?xml version="1.0"?>
> <mime-mapping>
>   <extension>txt</extension>
>   <mime-type>text/plain</mime-type>
> </mime-mapping>
>
> I then wrote this build.xml file:
>
> <?xml version="1.0"?>
> <project name="bc" default="init" basedir=".">
>   <taskdef name="xmltask" classname="
> com.oopsconsultancy.xmltask.ant.XmlTask"/>
>   <target name="init">
>     <xmltask source="web.xml" dest="web.xml" >
>       <insert path="/web-app/mime-mapping[1]" position="before" file="
> insert.xml"/>
>     </xmltask>
>   </target>
> </project>
>
> I then ran ant and got this new web.xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app>
>    <mime-mapping>
>       <extension>txt</extension>
>       <mime-type>text/plain</mime-type>
>    </mime-mapping>
>    <mime-mapping>
>       <extension>html</extension>
>       <mime-type>text/html</mime-type>
>    </mime-mapping>
> </web-app>
>
> This appears to do what you want, what part did you leave out?
> --
> Charles Knell
> [EMAIL PROTECTED] - email
>
>
>
> -----Original Message-----
> From:     broken connection <[EMAIL PROTECTED]>
> Sent:     Wed, 19 Sep 2007 13:45:17 -0400
> To:       "Ant Users List" <[email protected]>
> Subject:  Editing an XML file using ant
>
> Hi Friends,
>
> I want to add some extra mime-mappings to an web.xml file  in the
> deployment
> environment using my build script.I am trying using "XMLTASK" but for some
> reason it's not working. Is there any other way using ANT to accomplish
> this
> task.
>
> This is what i am trying with XMLTask:
>
> <xmltask source="${dest}/web.xml" dest="${dest}/web.xml" >
>    <insert path="/web-app/mime-mapping[1]" position="before" file="
> insert.xml">
>    </insert>
> </xmltask>
>
> It just copies the source web.xml to destination and does not appends
> anything.
>
>
> Thanks
> Mick
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to