Forum Discussion

vinodkumar_chau's avatar
vinodkumar_chau
Contributor
9 years ago
Solved

reading xml using selectSingleNode()

Hi All ,   How should i read the below xml using selectSingleNode().I have to take name as input i.e configuration name="MarkXX_Gas_1.22_Fwd_Win7" as input and then read the values. The function sh...
  • NisHera's avatar
    9 years ago

    try something like this.....you may hav to debug this code...

     

    doc = Sys.OleObject("Msxml2.DOMDocument.6.0");
    doc.async = false;
    doc.load(docPath);
    if(doc.parseError.errorCode != 0)
              { s = "Reason:\t" + doc.parseError.reason + "\n" +
               "Line:\t" + aqConvert.VarToStr(doc.parseError.line) + "\n" +
               "Pos:\t" + aqConvert.VarToStr(doc.parseError.linePos) + "\n" +
               "Source:\t" + doc.parseError.srcText;
               Log.Error("Cannot parse the document.", s);
               return; }
    strNode = "name = MarkXX_Gas_1.22_Fwd_Win7";
    Node = doc.selectSingleNode(strNode);
    childNodes = Node.childNodes;
    //Log.Message(childNodes.length);
    for(i=0;i<childNodes.length-1;i++){ //
    Log.Message (Node.childNodes.item(i).text);