Error reading XML file

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

  • Author
  • Message
Offline

vikas

  • Posts: 51
  • Joined: Wed May 13, 2015 7:46 pm

Error reading XML file

PostTue Jun 20, 2017 8:01 pm

Hi Plum

I am getting below error when reading an XML file in our Preprod environment.
Code is saved as "SafewayAutomation" in scratchpad. It is assigned to 855-606-3493.

I have verified the Javascript code in other editors and cannot find a reason why I am getting this error in Plum Voice.

TypeError: records[i] has no properties
Offline

support

  • Posts: 3456
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: Error reading XML file

PostWed Jun 21, 2017 12:40 pm

Hi Vikas,

It appears as though you are receiving this error because the JavaScript DOM version supported in our hosting site does not support the square bracket notation for iterating through objects. Instead, you should use the item() method. We were able to return "yahoo" by changing the following in your scratchpad:

Code: Select all
for (i = 0; i < records.length; i++) {
   if (records.item(i).childNodes.item(0).toString() === ani) {
         return ('yahoo');
   }
}


Note that we also added the toString() method since you are using the === operator for comparison, which does not perform type conversions. Since the item() method returns an object, but the ani variable in your code is a string, this comparison would evaluate to false without the toString() method, even if the two numbers were identical.

Regards,
Plum Support
Offline

vikas

  • Posts: 51
  • Joined: Wed May 13, 2015 7:46 pm

Re: Error reading XML file

PostWed Jun 21, 2017 1:33 pm

Thanks a lot. That worked

Return to Plum DEV Q&A

Who is online

Users browsing this forum: No registered users and 1 guest

cron