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

No declaration for attribute "accept" of element <data>

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

No declaration for attribute "accept" of element <data>

Post by vikas »

Hi Plum

We are getting below error when using <data> tag. This is the first time we are trying to use <data> tag with headers.
Code is being run in our Preprod environment.

This document is not valid VoiceXML!
No declaration for attribute accept of element data in Entity, line: 9  


Code: Select all

<?xml version="1.0"?>
<!DOCTYPE vxml PUBLIC "-//The Plum Group//DTD VOICEXML 2.1//EN" "/usr/local/plumvp/vxml.dtd">
<vxml version="2.1">
  <form>
    <block>
      <script>
        var headers = {"X-Sample-Header-1":"asdf 1234", "X-Sample-Header-2":"fdsa 4321"};
      </script>
      <data name="test" src="script.php" accept="application/json" headersexpr="JSON.stringify(headers)"/>
    </block>
  </form>
</vxml>

Regards
Vikas

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

Re: No declaration for attribute "accept" of element <data>

Post by support »

Hi Vikas,

The code itself appears as though it should function correctly. There may be an error in our VoiceXML validator that needs to be updated. Can you tell us what phone number you have assigned the scratchpad to so that we can verify?

Regards,
Plum Support

Meena
Posts: 2
Joined: Wed Apr 19, 2017 11:47 am

Re: No declaration for attribute "accept" of element <data>

Post by Meena »

Hi Plum,

This is in continuation of Vikas message about <data> tag.

I have created a scratchpad and assigned it: 855-202-5604
Appreciate your help.

thanks
Meena

vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

Re: No declaration for attribute "accept" of element <data>

Post by vikas »

I have created scratchpad and assigned it the no: 855-202-5604
Appreciate your help.

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

Re: No declaration for attribute "accept" of element <data>

Post by support »

Hi Vikas,

Although our VoiceXML validator does incorrectly produce an error with your scratchpad, we tested your code and it seems as though there is no problem with the scratchpad itself, but with the "script.php" file that the src attribute is set as in the data tag, resulting in a syntax error when the number you provided is called. Because you are testing this VXML from a scratchpad, the relative path to script.php given in the src attribute will not render an existing PHP script. Since you also have the accept attribute set as "application/json", the data tag is expecting to receive JSON back after being called. Therefore, in order for this scratchpad to work, you will need to change the src attribute to a fully qualified URL that returns JSON. We tested your scratchpad with the following code as "script.php" and received no errors when calling in, despite the VoiceXML validator producing an error with the scratchpad.

Code: Select all

<?php
header('Content-Type: application/json');
$data = array(
'first_name'=>'John',
'last_name'=>'Smith',
);
echo json_encode($data);
?>

More information on JSON integration with the data tag can be found in our documents here: http://www.plumvoice.com/docs/dev/voice ... on_example

If you have any further questions please let us know. We will also be updating the VXML validator to account for this type of situation, so it will not return a false error.

Regards,
Plum Suppport

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

Re: No declaration for attribute "accept" of element <data>

Post by support »

Hi Vikas,

The update to the VXML validator has been completed. We tested your scratchpad and it is no longer indicating an error.

Please let us know if you encounter any other issues.

Regards,
Plum Support

Post Reply