VoiceXML 2.1 Development GuideHome  |  Frameset Home


<rule>  element

The rule element defines the named rule expansion of an XML grammar.


usage
<rule id="ID" scope="(private|public)">


attributes
idData Type: IDDefault: Required
The id attribute specifies the rulename of the grammar. Rulenames must be unique within the file itself, and may not contain hyphens, colons, or periods.
scopeData Type: (private|public)Default: private
The scope attribute denotes whether or not the XML grammar is a private (local), rule, or if it is a public rule, which is used for an external rule reference.



shadow variables
none


parents
<grammar>


children
<example> <item> <one-of> <ruleref> <tag> <token>


code samples
<Rule_ID_ScopeCode.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"/>


<form id="F1">

  <field name="F_1">
    <prompt>
      Which is it better to be, a Call XML snob, or a Voice XML snob?
    </prompt>

    <grammar src="MyRuleGrammar.xml" type="application/grammar-xml"/>

    <filled>
      <prompt>
        Thats right. Voice XML rocks the hizzau!
    </prompt>

  </filled>

  </field>

</form>

</vxml>

2.0 <MyRuleGrammar.xml>
<?xml version= "1.0"?>

<grammar xmlns="http://www.w3.org/2001/06/grammar"
      xml:lang="en-US" root = "MYRULE">

  <rule id="MYRULE" scope="public">
    <one-of>
      <item> voice x m l snob </item>
    </one-of>
  </rule>
    <!-- Hey, what did you expect? We *all* know which one is King.-->
</grammar>



additional links
W3C SRGS 1.0 Specification


  ANNOTATIONS: EXISTING POSTS
moshe
6/7/2004 10:47 AM (EDT)
It goes without saying that this element has plenty of parents and children, as shown in the example. The lack of parents and children is a documentation error.
MattHenry
6/7/2004 12:50 PM (EDT)
The inclusion of these parent/child relationships was flagged in our DB for the VWS platform, but was overlooked within the Motorola docset. This has been corrected in our most recent Build, and will be posted to the 'live' content shortly.

~Matt

login



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