You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Giovanni Mesturini <jo...@yahoo.it> on 2006/02/13 15:42:32 UTC

Change XML by Ant

Hi community,

is there a way to change an XML file using Ant's
script? I found the XMLProperty tasks that reads an
XML, but it seems to be read-only.

from a file

  <root>
    <properties>
      <foo value="1"/>
      <foo value="2"/>
      <foo value="1"/>
      <foo value="3"/>
    </properties>
  </root>

I have to remove every <property> that have value="1",
in order to have as result

  <root>
    <properties>
      <foo value="2"/>
      <foo value="3"/>
    </properties>
  </root>

I need this because I'm building up an Eclipse
workspace with Ant, so in order to change projects
dependencies I have to manipulate XML config files
too.

Thank you very much
Jo



	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it

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


Re: Change XML by Ant

Posted by Steve Loughran <st...@apache.org>.
Giovanni Mesturini wrote:
> Hi community,
> 
> is there a way to change an XML file using Ant's
> script? I found the XMLProperty tasks that reads an
> XML, but it seems to be read-only.

Ant1.7 will have <echoxml> for simple XML output. For complex stuff 
(xmlnamespaces, new headers, different encodings), <echo>  is still the 
tool of choice


     <echo file="${target.pom}"><![CDATA[<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>${m2.groupID}</groupId>
   <artifactId>${artifact.name}</artifactId>
   <packaging>jar</packaging>
   <version>${Version}</version>
</project>
   ]]></echo>

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


Re: Change XML by Ant

Posted by Patrick Martin <an...@gmail.com>.
Hello,

You can also try xmltask :
http://www.oopsconsultancy.com/software/xmltask/index.html

Regards,

Patrick M.

On 2/13/06, Kees van Dieren <ke...@mp-objects.com> wrote:
> You can try the Ant xslt task:
> http://ant.apache.org/manual/CoreTasks/style.html
>
> Best regards,
>
> Kees van Dieren
> Senior Software Engineer
>
> MP Objects Supply Chain Software
> Stationsplein 45
> 3013 AK Rotterdam
> The Netherlands
>
> Post address:
> Postbus 29126
> 3001 GC Rotterdam
>
> Mobile: +31 (0)6-43068619
> Phone: +31 (0)10-2900304
> Fax: +31 (0)10-2900305
> MSN: keesvandieren@gmail.com
>
>
> -----Original Message-----
> From: Giovanni Mesturini [mailto:jo_4_ant@yahoo.it]
> Sent: Monday, February 13, 2006 3:43 PM
> To: user@ant.apache.org
> Subject: Change XML by Ant
>
> Hi community,
>
> is there a way to change an XML file using Ant's script? I found the
> XMLProperty tasks that reads an XML, but it seems to be read-only.
>
> from a file
>
>   <root>
>     <properties>
>       <foo value="1"/>
>       <foo value="2"/>
>       <foo value="1"/>
>       <foo value="3"/>
>     </properties>
>   </root>
>
> I have to remove every <property> that have value="1", in order to have as
> result
>
>   <root>
>     <properties>
>       <foo value="2"/>
>       <foo value="3"/>
>     </properties>
>   </root>
>
> I need this because I'm building up an Eclipse workspace with Ant, so in
> order to change projects dependencies I have to manipulate XML config files
> too.
>
> Thank you very much
> Jo
>
>
>
>
>
>
>
> ___________________________________
> Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
> http://mail.yahoo.it
>
> ---------------------------------------------------------------------
> 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
>
>

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


RE: Change XML by Ant

Posted by Kees van Dieren <ke...@mp-objects.com>.
You can try the Ant xslt task:
http://ant.apache.org/manual/CoreTasks/style.html 

Best regards,

Kees van Dieren
Senior Software Engineer

MP Objects Supply Chain Software
Stationsplein 45
3013 AK Rotterdam
The Netherlands

Post address:
Postbus 29126
3001 GC Rotterdam

Mobile: +31 (0)6-43068619
Phone: +31 (0)10-2900304
Fax: +31 (0)10-2900305
MSN: keesvandieren@gmail.com


-----Original Message-----
From: Giovanni Mesturini [mailto:jo_4_ant@yahoo.it] 
Sent: Monday, February 13, 2006 3:43 PM
To: user@ant.apache.org
Subject: Change XML by Ant

Hi community,

is there a way to change an XML file using Ant's script? I found the
XMLProperty tasks that reads an XML, but it seems to be read-only.

from a file

  <root>
    <properties>
      <foo value="1"/>
      <foo value="2"/>
      <foo value="1"/>
      <foo value="3"/>
    </properties>
  </root>

I have to remove every <property> that have value="1", in order to have as
result

  <root>
    <properties>
      <foo value="2"/>
      <foo value="3"/>
    </properties>
  </root>

I need this because I'm building up an Eclipse workspace with Ant, so in
order to change projects dependencies I have to manipulate XML config files
too.

Thank you very much
Jo



	

	
		
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it

---------------------------------------------------------------------
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