javascript xml dom parsing error - selectSingleNod

Results 1 to 2 of 2

Thread: javascript xml dom parsing error - selectSingleNod

  1. #1
    Join Date
    Dec 1969

    Default javascript xml dom parsing error - selectSingleNod

    Hi all!<BR><BR>I have written a function to fetch lebels from xml file for cross-language interoperability. Please refer function code below.<BR><BR>I am invoking itfrom my asp page saying &#060;%=getValueForLabelNode(strLanguage,"English" ).toString()%&#062;<BR><BR>It gives me an error &#039;Microsoft JScript runtime (0x800A138F)<BR>&#039;undefined&#039; is null or not an object&#039;<BR><BR>-----function code---<BR>function getValueForLabelNode(lang, nodename)<BR>{<BR>try<BR> {<BR>// Name: getValueForLabelNode<BR>// Input: Language code, Node name<BR>// Output: Label Text<BR>// Description: Fetches the Label Message for the language code specified and the Label Name passed<BR>// Author: IGSI - 2004<BR><BR>var LabelDoc= Server.CreateObject("MSXML2.DOMDocument");<BR>var sPattern<BR>var objLabels<BR>var docurl<BR><BR><BR>docurl = "../data/DebitMgrLabels.xml"<BR><BR>LabelDoc.async = false //asynchronous download not permitted<BR>LabelDoc.validateOnParse = true //Validates during parsing<BR>LabelDoc.load (Server.MapPath(docurl)) //Loads the xml resource at the passed docurl<BR><BR>// No parsing error<BR>if (LabelDoc.parseError.errorCode == 0) {<BR> //pattern to match the langauge node and corresponding Lable node<BR> sPattern = "//language[@name=&#039;" + lang + "&#039;]//label[@name=&#039;" + nodename + "&#039;]"<BR> <BR> //ToDo. the below line returns undefined. Pls correct it.<BR> objLabels = LabelDoc.selectSingleNode(sPattern);<BR> <BR> //returning the text for the nodename passed<BR> return objLabels.Text<BR> }<BR> }<BR> catch(e)<BR> {<BR> return e.description;<BR> }<BR>}

  2. #2
    Join Date
    Dec 1969

    Default Which line does the error...

    ...refer to? Can you highlight it in your code? What debugging have you done? Have you written this code yourself?<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts