Could you loop around the command updating the index until no return
value was found? Something like:

 

<foreach item="String" in="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"
delim="," property="index">

 

<xmlpeek file="${config.file}" indexnode="${index}"
xpath="/some_stuff/client/clientname" 
            property="client.name" /> 
        <echo message="client.name: ${client.name}"/>
</foreach>

 

Of course, you are limited to listing enough index values. Is it
possible you could just put a list of clients in a text file, and loop
through that?

 

Another option is to write a c# task inline that returns a string of all
the client values separated by a comma and then use that in your loop as
the in property.

 

BOb

 

 

________________________________

From: Steve Kapinos [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 16, 2008 12:18 PM
To: Fabio Gil; nant-users@lists.sourceforge.net
Subject: Re: [NAnt-users] xmlpeek - Multiple nodes found with
theXPathexpression

 

You need to use the nodeindex parameter of xmlpeek to control which
instance you are returning.  However, I'm not quite sure how you'd find
out how many instances there are to loop through dynamically.  Maybe
some if condition on the returned value and a loop of sorts

 

-Steve

 

From: Fabio Gil [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 16, 2008 11:53 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] xmlpeek - Multiple nodes found with the
XPathexpression

 

Hello,

I'm spinning my wheels with this issue and don't know how to solve it. I
have an XML file that contains the name of the client I will build my
app for. 

This is an excerpt of the XML file:

                <client>
                    <clientname>client1</clientname>
                    ...
                </client>
                <client>
                    <clientname>client2</clientname>
                    ...
                </client>
                <client>
                    <clientname>client3</clientname>
                    ...
                </client>

I have written a small Nant script to read from the file and send a
message to the console

        <xmlpeek file="${config.file}"
xpath="/some_stuff/client/clientname" 
            property="client.name" /> 
        <echo message="client.name: ${client.name}"/>

What I've got as a response is

  [xmlpeek] Peeking at 'myxmlfile.xml' with XPath expression
'/some_stuff/client/clientname'.
  [xmlpeek] Found '6' nodes with the XPath expression
'/ifast_desktop/distribution/release/installsh
ield/client/clientname'.
     [echo] client.name: client1

BUILD SUCCEEDED

I need to be able to use client.name as a parameter for my build but
ultimately I am only getting the first appearance of the clientname.

Is there a way to do what I am trying to do?

Thanks very much!

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to