VoiceXML 2.1 Development GuideHome  |  Frameset Home


<vxml>  element

The vxml element is the initial declaration that defines a document as a VoiceXML application.


usage
<vxml application="CDATA" version="(2.0|2.1)" xml:base="CDATA" xml:lang="NMTOKEN" xmlns="http://www.w3.org/2001/vxml" xmlns:voxeo="http://community.voxeo.com/xmlns/vxml">


attributes
applicationData Type: CDATADefault: Optional
The value of  the application attribute is a URI used to specify the applications root document. When specified, all event handlers, variables, links, grammars, and scripts contained within the root document are considered active when each document  loads. All variables declared within the root document are then considered to have application scope, and are available at any point in the application.
versionData Type: (2.0|2.1)Default: Optional
The version attribute represents the VoiceXML version number. Note that specifying the version as '2.1' is required when using the new 2.1 elements, such as the data element.
xml:baseData Type: CDATADefault: Optional
The URI value of the xml:base attribute denotes the base URL of the document. All relative URI’s contained in the document are derived from the base attributes value. If unspecified, then the platform assumes that the current URI is the value of the base attribute.
xml:langData Type: NMTOKENDefault: Optional (en-US)
The xml:lang attribute specifies the language and locale information of the VoiceXML document. If omitted, it will inherit this value from the document hierarchy, or ultimately from the platform default, which equates to 'en-US'.
xmlnsData Type: http://www.w3.org/2001/vxmlDefault: http://www.w3.org/2001/vxml
The xmlns attribute defines the VoiceXML namespace; all tags and attributes belong to this namespace. If specifying the xmlns:nuance attribute in your code, this element will be filled in by default.
xmlns:voxeoData Type: http://community.voxeo.com/xmlns/vxmlDefault: none - attribute is optional
The 'xmlns:voxeo' attribute is a required setting that refers to the xml namespace used when a developer includes a voxeo extension element to the VXML specification, (such as <voxeo:recordcall>). This attribute value should always be specified as 'http://community.voxeo.com/xmlns/vxml'



shadow variables
none


parents
none


children
<catch> <error> <form> <help> <link> <menu> <meta> <noinput> <nomatch> <property> <script> <var>


code samples
<AppRoot.vxml>
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">


<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<catch event="GlobalEvent">
        <prompt> we caught a global event. </prompt>
    </catch>

<form id="F1">
  <block>
    <prompt>
      here is some text that will not be executed.
    </prompt>
    </block>
</form>
</vxml>

<Vxml application-xml:base> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1"
application="AppRoot.vxml" xml:base="http://ThisServer/ThisDirectory/">



<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1">
  <block>
    <prompt> preparing to throw a global event, which will be
          caught by the application root document.
    </prompt>
    <throw event="GlobalEvent"/>
  </block>
</form>
</vxml>



additional links
W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
jasrags
4/30/2004 1:06 PM (EDT)
in :
code samples

2.-0 <AppRoot.vxml>

<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.0" <----- Missing tailing ">"
MattHenry
4/30/2004 1:48 PM (EDT)
Thanks for catching yet another typo for me; i have this fixed in the most recent build.

~Matt
awirtz
1/26/2005 8:38 PM (EST)
If you need to track down XML syntax errors in a VXML document, you might try adding the following DOCTYPE element and using an XML validator:

<!DOCTYPE vxml SYSTEM "http://www.w3.org/TR/voicexml21/vxml.dtd">

This tag should be placed after the <?xml?> tag and before the <vxml> tag in your document.  There is a publicly available XML validator here:

http://www.stg.brown.edu/service/xmlvalid/

(Note that the first 4 warnings it outputs are complaints about the DTD file at W3 and are not directed at your document.  Ignore them.)
codingace
1/23/2008 2:47 PM (EST)
This is great for manually throwing an event, but what if a hangup or disconnect takes place? Is there a nice way to handle the catch event at the application level?
VoxeoDustin
1/23/2008 4:44 PM (EST)
Hey,

There sure is. You'll simply need to create a root document that contains your <catch>.

For example:

root.vxml
--------
<?xml version="1.0"?>
<vxml version="2.1">

  <catch event="connection.disconnect.hangup">
      <!-- do our clean up -->
    <exit/>
    <!-- we absolutely MUST explicitly exit in any connection.disconnect handler
    to kill the session -->
  </catch>

</vxml>


leaf.vxml
--------
<?xml version="1.0"?>
<vxml version="2.1" application="root.vxml">

<!-- our code here -->

</vxml>

Note: The <catch> event must be scoped at the <vxml> level and that your leaf documents must have a voice reco field for the event to be caught.

Thanks,
Dustin
jaffar
6/11/2008 8:03 AM (EDT)
i want to create a vxml file in that i want to validate the user three times..like first i want to confirm his name,pin,password..
can u please giv me the vxml code for that....
voxeojeremyr
6/11/2008 11:07 AM (EDT)
Hi,

We have lots of examples in our tutorials about things like this that you can find here:
http://docs.voxeo.com/voicexml/2.0/learningvoicexml.htm

But also, here is some sample code that should pint you in the right direction:

<form>
    <field name = "name">
          <prompt> What is the name? </prompt>
          <grammar type="application/grammar+xml" src= "name.grxml"/>
    </field>
    <field name = "pin" type="digits">
          <prompt> What is your pin? </prompt>
    </field>
    <filled>
          <if cond = "pin != '1234'">
                <prompt> That is the wrong pin </prompt>
                <reprompt/>
                <clear namelist = "pin"/>
            </if>
      </filled>
</form>

Thanks,
Jeremy Richmond
Voxeo Support
jlust
11/6/2008 6:13 PM (EST)
In my application I want to capture the current location of the user as the proceed through the script. The intention is to know where they are when they hangup. I know that I can get this information by parsing CPA files, but it is much simpler to track it in the script. However, is there an easier way? Is there any VXML application or platform property like application.lastform or .currentform which can be access on Session.telephone.Hangup?

Thanks.

-Joe
voxeoJohn
11/6/2008 7:02 PM (EST)
Hi,

    Unfortunately there are no session variable to do explicitly what you are looking for here, however this behavior is rather simple to create via the <assign> element.  Simply assigning a 'state' to a variable in each section or form seems like it would achieve just what you are looking for.  This is similar to the state variable in CCXML.  If you are looking to archive this then you can make use of the <data> element and post it for server side processing at your disconnect handler. 

    I hope that helps and please let us know if there are any additional questions as we are certainly standing by to offer any assistance out developers may require!

Regards,

John D.
Customer Engineer
Voxeo Support

login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site