You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Alpesh Vesuwala <al...@yahoo.co.in> on 2008/07/30 14:59:15 UTC

Re: How to read an XML file and extract values for the attributes using ANT script

Thanks Brian,

It works as per what I expected. :drunk:

Thank you very much,
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-tp18648408p18732640.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: How to read an XML file and extract values for the attributes using ANT script

Posted by Alpesh Vesuwala <al...@yahoo.co.in>.
SUPERB =)

I was trying,
        <call path="//TITLE" >
		/ :rules: XYZ/text()"/>
		/ :rules: ABC/text()"/>
                <actions>
			<echo>@{xyz} = @{abc}</echo>
                </actions>
        </call>

Thanks a lot,
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-tp18648408p18752935.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: How to read an XML file and extract values for the attributes using ANT script

Posted by Brian Agnew <br...@oopsconsultancy.com>.
Well, that's slightly different. The follwoing will illustrate what you
need..

<xmltask source="title.xml">
        <call path="//TITLE" >
		<param name="xyz" path="XYZ/text()"/>
		<param name="abc" path="ABC/text()"/>
                <actions>
			<echo>@{xyz} = @{abc}</echo>
                </actions>
        </call>
</xmltask>

Brian

On Thu, July 31, 2008 10:21, Alpesh Vesuwala wrote:
>
> Hi,
>
> Thanks for your quick response.
> The solution is fine but not working when my XML file looks like this:
>
> <TITLE>
>      <XYZ>123</XYZ>
>      <ABC>456</ABC>
> </TITLE>
> <TITLE>
>      <XYZ>987</XYZ>
>      <ABC>654</ABC>
> </TITLE>
> <TITLE>
>      <XYZ>147</XYZ>
>      <ABC>258</ABC>
> </TITLE>
>
> Thanks and Regards,
> Alpesh
>
>
> You should be able to do that with a param to call. i.e. identify the node
> you're interested in with:
>
> <call path="....">
>
> and specify a param:
>
>  questions, which may
> be a better forum going forwards.
>
> Brian
> --
> View this message in context:
> http://www.nabble.com/How-to-read-an-XML-file-and-extract-values-for-the-attributes-using-ANT-script-tp18648408p18750721.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


Re: How to read an XML file and extract values for the attributes using ANT script

Posted by Alpesh Vesuwala <al...@yahoo.co.in>.
Hi,

Thanks for your quick response.
The solution is fine but not working when my XML file looks like this:

<TITLE>
     <XYZ>123</XYZ>
     <ABC>456</ABC>
</TITLE>
<TITLE>
     <XYZ>987</XYZ>
     <ABC>654</ABC>
</TITLE>
<TITLE>
     <XYZ>147</XYZ>
     <ABC>258</ABC>
</TITLE>

Thanks and Regards,
Alpesh


You should be able to do that with a param to call. i.e. identify the node
you're interested in with:

<call path="....">

and specify a param:

 questions, which may
be a better forum going forwards.

Brian
-- 
View this message in context: http://www.nabble.com/How-to-read-an-XML-file-and-extract-values-for-the-attributes-using-ANT-script-tp18648408p18750721.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: How to read an XML file and extract values for the attributes using ANT script

Posted by Brian Agnew <br...@oopsconsultancy.com>.
You should be able to do that with a param to call. i.e. identify the node
you're interested in with:

<call path="....">

and specify a param:

<param path="following-sibling:...

Note there's a dedicated mailing list for <xmltask> questions, which may
be a better forum going forwards.

Brian

On Thu, July 31, 2008 08:46, Alpesh Vesuwala wrote:
>
> Hey one more twist has come with my requirement.
>
> the above solution of xmltask requires separate 'call' to loop through
> 'XYZ'
> and 'ABC'
> Resulting in, I have first all the values of XYZ and then for ABC. and I
> want values for both together.
>
> e.g.
> <TITLE>
>         <ABC>abc</ABC>
>         <XYZ>xyz</XYZ>
>
>         <ABC>123</ABC>
>         <XYZ>456</XYZ>
>
>         ...
>         ...
>
> </TITLE>
>
> The 'call' should fetch values for both ABC and XYZ at a same time %-|
>
> 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-tp18648408p18749436.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


Re: How to read an XML file and extract values for the attributes using ANT script

Posted by Alpesh Vesuwala <al...@yahoo.co.in>.
Hey one more twist has come with my requirement.

the above solution of xmltask requires separate 'call' to loop through 'XYZ'
and 'ABC'
Resulting in, I have first all the values of XYZ and then for ABC. and I
want values for both together.

e.g.
<TITLE>
        <ABC>abc</ABC>
        <XYZ>xyz</XYZ>

        <ABC>123</ABC>
        <XYZ>456</XYZ>

        ...
        ...

</TITLE>

The 'call' should fetch values for both ABC and XYZ at a same time %-|

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