-1

I have to read the below xml using selectSingleNode() using javascript.The function will get attribute 'name' value (MarkXX_Gas_1.22_Fwd_Win7) using project variable in testcomplete . using that value select the configuration whose attribute name value is similiar to passed value and then read all other attribute values. After that read the child node Meters and its sub child and attribute values. I have to specifically use selectSingleNode().

<?xml version="1.0"?>
<configurations>
 <configuration name="MarkXX_Gas_1.22_Fwd_Win7" OSName="Win7" OSServicePack="Service Pack 1" Windows64bit="True" OfficeVersion="2010" OfficeServicePack="SP1" UserAccountType="Domain" Locale="en-US" IEVersion="10.0.9200.17267">
  <meters>
      <meter Name="Meter1" ProductType="0" DeviceNumber="3414" FlowDirection="1" CPUBdSwVer="1.22-Gas_Sp3pt02_Eval-20150521_0725 2015/05/21" IPAddress="10.129.194.184" ConnectionType="0" />
   </meters>
 </configuration>
</configurations>
vinu
  • 191
  • 2
  • 7
  • 22
  • The way the question is formulated, in steps "*Do this, then this, then use it to...*" resembles a school question. What have you tried so far by yourself, @vinu? – Daniel B Jul 10 '15 at 08:32

1 Answers1

0

I have written the below code but its printing "Version 1.0".

function GetTestConfiguration()
    {
        // get intended test config file Path
        var strFilePath = "..\\CommonFiles\\IntendedTestConfig.xml";


        // create XML DOM object
        var objDocXML = new ActiveXObject("Microsoft.XMLDOM");


        // load xml
        objDocXML.load(strFilePath);
        var strNode = objDocXML.selectSingleNode("//configuration/name/");
        Log.Message(strNode.text);
    }
vinu
  • 191
  • 2
  • 7
  • 22