-1

I am trying to load xml file asynchronously but when i call LoadXML(docname) in TestConfiguration() and print the return value , it does not print anything.

function TestConfiguration()
{
    var strFilePath = "..\\CommonFiles\\TestConfig.xml";
    var retVal = LoadXML(strFilePath);
    Log.Message(retVal);
}
function LoadXML(docname)
    {
    try {
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    }
    catch(e) {
        Log.Message(e.message);
    }
    try {
        xmlDoc.async=true;
        xmlDoc.load(docname);
        return(xmlDoc);
    }
    catch(e) {
    Log.Message(e.message);
    }
    return(null);
}
vinu
  • 191
  • 2
  • 7
  • 22

1 Answers1

0

You put the XML Doc object to the Log.Message method. This is an object and cannot be printed. You need to print this object's XML property instead:

function TestConfiguration()
{
    var strFilePath = "..\\CommonFiles\\TestConfig.xml";
    var retVal = LoadXML(strFilePath);
    Log.Message(retVal.xml);
}
Dmitry Nikolaev
  • 3,803
  • 2
  • 19
  • 23
  • How do i return success or failure after reading the xml nodes and its attributes to the caller. Any function which could help to do it ? – vinu Jul 28 '15 at 11:05
  • To understand whether an operation is successful, you can check its result for null - (retVal.selectSingleNode("kkk") == null). BTT, I would appreciate it if you marked my answer as accepted. – Dmitry Nikolaev Jul 29 '15 at 07:58