i have read below xml using selectsinglenode() using javascript.the function attribute 'name' value (markxx_gas_1.22_fwd_win7) using project variable in testcomplete . using value select configuration attribute name value similiar passed value , read other attribute values. after read child node meters , sub child , attribute values. have 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>
i have written below code printing "version 1.0".
function gettestconfiguration() { // 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); }
Comments
Post a Comment