Use nodeindex and get them one at a time. Here is the documentation on xmlpeek:
 
http://nant.sourceforge.net/release/latest/help/tasks/xmlpeek.html


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shelly Midha
Sent: Wednesday, May 25, 2005 1:26 AM
To: nant-users@lists.sourceforge.net
Subject: [Nant-users] <xmlpeek> returns multiple node values

 

I'm using <xmlpeek> to read xml configuration file. I want to retreive the 'value' for given value of <name>

 

When using <xmlpeek> as in the follwoing target,

 

<target name="read-db-server-data-path">

    <echo message="reading db server configuration from ${DB.DBFilePath}"/>

    <xmlpeek verbose="false" file="${DB.DBFilePath}" xpath="/parameters/parameter/name" property="DB.DataFilePath" />

    <xmlpeek verbose="false" file="${DB.DBFilePath}" xpath="/parameters/parameter/name" property="DB.LogFilePath" />

    <echo message="${DB.DataFilePath}"/>

</target>

 

XML file ---

***************************************************************************************

<?xml version="1.0" encoding="utf-8" ?>
  
<parameters>
<!--Time-stamp: 2002-08-11 19:56:19 @userid   -->
  <parameter>
    <name>DATA_FILE_DIR</name>
    <value>C:\Program Files\Microsoft SQL Server\MSSQL\data</value>
  </parameter>
  <parameter>
    <name>LOG_FILE_DIR</name>
    <value>C:\Program Files\Microsoft SQL Server\MSSQL\data</value>
  </parameter>
</parameters>
***************************************************************************************

get the follwoing output:

___________________________________________________________________

read-db-server-data-path:

     [echo] reading db server configuration from E:Delete\BRConfig\SkillsTrackin
g\SkillsTracking.instance.db_parameters.servername.conf.xml
  [xmlpeek] Peeking at 'E:\Delete\BRConfig\SkillsTracking\SkillsTracking.instanc
e.db_parameters.servername.conf.xml' with XPath _expression_ '/parameters/paramete
r/name'.
  [xmlpeek] Found '2' nodes with the XPath _expression_ '/parameters/parameter/nam
e'.
  [xmlpeek] Peeking at 'E:\Delete\BRConfig\SkillsTracking\SkillsTracking.instanc
e.db_parameters.servername.conf.xml' with XPath _expression_ '/parameters/paramete
r/name'.
  [xmlpeek] Found '2' nodes with the XPath _expression_ '/parameters/parameter/nam
e'.
     [echo] DATA_FILE_DIR

BUILD SUCCEEDED

Total time: 0.2 seconds.

___________________________________________________________________

 

How to retrieve the value at both the nodes?

 

Any pointers to resolve the same are  highly appreciated.

 

Thanks

Shelly

 

Reply via email to