You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Klaus Malorny <Kl...@knipp.de> on 2009/03/05 10:00:05 UTC

Ant & patching XML files

Hi all,

I am looking for a method to manipulate XML files from Ant, i.e. adding/removing 
elements, changing attributes or elements' contents, far simpler than the 
capabilities of XSL/T. I have found the XmlTask ([1], [2]) and this seems to be 
quite flexible. However, as part of a configuration management, I would prefer 
to keep the "delta" files outside of the Ant script (maybe in the format of RFC 
5261), and this task does not seem to support that. Before choosing XmlTask I 
just want to ask whether there are any other known tasks that would allow 
external delta files. Thanks in advance.

Regards,

Klaus

[1] http://ant.apache.org/external.html#XmlTask
[2] http://www.oopsconsultancy.com/software/xmltask/

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


Re: AW: Ant & patching XML files

Posted by Antoine Levy Lambert <an...@gmx.de>.
Uhhmm,

did you read the documentation under 
http://ant.apache.org/manual/CoreTasks/replace.html ?

I think the first example applies very well to what you want to do.

It says this : <replace file="${src}/index.html" token="@@@" 
value="wombat"/>

so you would do <replace file="config.xml" token="myAMFSessionURL" 
value="newAMFSessionURL"/>

assuming the xml configuration file is called config.xml and is in the 
same directory like the Ant build file.

Regards,

Antoine

Sunils_82 wrote:
> Hi,
>
> My xml configuration file has following format:
> <channels>
>         <channel-definition class="MyChannel" id="myChannelId">
>                 <endpoint class="endPointClass" uri="myURL"/>
>         </channel-definition>
>         
>         <channel-definition class="MyAMFChannel" id="myAMFSession"> 
> 	        <endpoint uri="myAMFSessionURL"/> 
>         </channel-definition>
> </channels>
>
> Now how do i perform the REPLACE task in this case to replace
> 'myAMFSessionURL' to 'newAMFSessionURL'
>
> Regards,
> Sunil
>   


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


Re: AW: Ant & patching XML files

Posted by Sunils_82 <su...@yahoo.com>.
Hi,

My xml configuration file has following format:
<channels>
        <channel-definition class="MyChannel" id="myChannelId">
                <endpoint class="endPointClass" uri="myURL"/>
        </channel-definition>
        
        <channel-definition class="MyAMFChannel" id="myAMFSession"> 
	        <endpoint uri="myAMFSessionURL"/> 
        </channel-definition>
</channels>

Now how do i perform the REPLACE task in this case to replace
'myAMFSessionURL' to 'newAMFSessionURL'

Regards,
Sunil
-- 
View this message in context: http://www.nabble.com/Ant---patching-XML-files-tp22347624p22368181.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: AW: Ant & patching XML files

Posted by Klaus Malorny <Kl...@knipp.de>.
On 05/03/09 10:04, Jan.Materne@rzf.fin-nrw.de wrote:
> see
> http://marc.info/?l=ant-user&m=123255143025824&w=2
>
> Jan
>

Hi,

as this is the one I mentioned in my e-mail, this means there is no alternative?

Regards,

Klaus

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


AW: Ant & patching XML files

Posted by Ja...@rzf.fin-nrw.de.
see
http://marc.info/?l=ant-user&m=123255143025824&w=2

Jan 

>-----Ursprüngliche Nachricht-----
>Von: Klaus Malorny [mailto:Klaus.Malorny@knipp.de] 
>Gesendet: Donnerstag, 5. März 2009 10:00
>An: Ant Users List
>Betreff: Ant & patching XML files
>
>
>Hi all,
>
>I am looking for a method to manipulate XML files from Ant, 
>i.e. adding/removing 
>elements, changing attributes or elements' contents, far 
>simpler than the 
>capabilities of XSL/T. I have found the XmlTask ([1], [2]) and 
>this seems to be 
>quite flexible. However, as part of a configuration 
>management, I would prefer 
>to keep the "delta" files outside of the Ant script (maybe in 
>the format of RFC 
>5261), and this task does not seem to support that. Before 
>choosing XmlTask I 
>just want to ask whether there are any other known tasks that 
>would allow 
>external delta files. Thanks in advance.
>
>Regards,
>
>Klaus
>
>[1] http://ant.apache.org/external.html#XmlTask
>[2] http://www.oopsconsultancy.com/software/xmltask/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

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