We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

How can I pass a XML object down with the VXML

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
Rich
Posts: 8
Joined: Mon Jun 13, 2011 5:51 pm

How can I pass a XML object down with the VXML

Post by Rich »

I would like to pass down a data object of type XML DOM with the initial VoiceXML. This would be the same data type that is passed back on a <data> web service call.

Rather than fetch the voice XML then turn around and fetch the initial XML data Object I want to pass the initial XML data object down with the voice XML for performance reasons.

If possible I could create the XML DOM in script but I cant figure out what kind of object to create and how to load it either.

Thanks,

Rich

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: How can I pass a XML object down with the VXML

Post by support »

Hi Rich,

The data tag is generally the preferred route when fetching XML data. So long as the XML file it not unusually large there needn't be any performance concerns. If you are loading predefined values, you could simply add the data values to your script by defining them using <var> tags, or alternatively loading a Javascript object using the <script> tag as such:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.1">
  <form>
    <script>
      var users = new Array();
      users[0] = new Object();
      users[0].name = 'John Hughes';
      users[0].age = 36;
      users[1] = new Object();
      users[1].name = 'John Smith';
      users[1].age = 25;
    </script>
    <block>
      <prompt>
        Hello, <value expr="users[0].name"/>.
      </prompt>
  </block>
  </form>
</vxml>
We were wondering if you could give an example of your use case for loading the XML data at the beginning of your script so that we could potentially provide some additional insight into how to achieve your goal.

Regards,
Plum Support

Post Reply