ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Agnew" <br...@oopsconsultancy.com>
Subject Re: How to read an XML file and extract values for the attributes using ANT script
Date Wed, 30 Jul 2008 11:56:17 GMT
You can use <xmltask> and its <call> function. e.g.

<call path="/TITLE/XYZ">
  <param name="val" path="text()"/>

  <actions>
    <echo>val = @{val}</echo>
  </actions>
</call>

and some additional XPath magic ('following-sibling' or similar) to get
the following XYZ node (not tried this, though! You may need an XPath
tutorial like http://www.zvon.org/xxl/XPathTutorial/General/examples.html
)

Brian

On Wed, July 30, 2008 12:07, Alpesh Vesuwala wrote:
>
> Thank you all for your valuable inputs.
>
> I tried 'xmltask' for my solution and it is working really well. :jumping:
> I really appreciate your kind responses. =)
>
> Please clarify one more doubt,
> I may have multiple tags and they can be random.
>
> For example,
>
> <TITLE>
>         <ABC>abc</ABC>
>         <XYZ>xyz</XYZ>
>
>         <ABC>123</ABC>
>         <XYZ>456</XYZ>
>
>         ...
>         ...
>
> </TITLE>
>
> How can I do loop through each tags, like for and while loop in java :-((
>
> Thanks,
> Alpesh
> --
> View this message in context:
> http://www.nabble.com/How-to-read-an-XML-file-and-extract-values-for-the-attributes-using-ANT-script-tp18648408p18730889.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
>


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


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


Mime
View raw message