<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xdr-schema.xsl"?>
<Schema name="GRAMMAR" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes">
   <description> This schema describes the SAPI 5.0 SR Command and Control grammar format which is based on the XML framework. The schema is included in the speech grammar compiler tool (gramcomp.exe or gc.exe) and does not need to be included in your grammar files. It is provided as a reference document. 

NOTE: This schema is based on the Microsoft schema language and is not fully W3C compliant. This schema will be rewritten and will be compliant with the W3C standard once it has been approved by the W3C.</description>
   <!-- Attribute definitions -->
   <AttributeType  name="LANGID" dt:type="int" required="yes">
      <description>Defines the language ID of the XML grammar. If not specified, the grammar's LangID will default to the current user's UI language. The Speech Recognition engine must support the grammar's language Id for the grammar to successfully be loaded.</description>
   </AttributeType>
   <AttributeType  name="WORDTYPE" dt:type="BSTR" dt:values="LEXICAL" default="LEXICAL" required="no">
      <description>Specifies the type of the word(s) to be added to the grammar. Value must be the string "LEXICAL" with SAPI 5.0 and SAPI 5.1. See also SPGRAMMARWORDTYPE.</description>
   </AttributeType>
   <AttributeType  name="LEXDELIMITER" dt:type="string" default="/" required="no">
      <description>Specifies the delimiter that SAPI should use to separate an explicit lexicon entry in the grammar. The format is "LEXDELIMITER DisplayForm LEXDELIMITER LexicalForm LEXDELIMITER Pronunciation ;"</description>
   </AttributeType>
   <AttributeType  name="NAME" dt:type="string" required="no">
      <description>Specifies the string identifier that will be associated with a rule.</description>
   </AttributeType>
   <AttributeType  name="ID" dt:type="string" required="no">
      <description>Specifies the numeric identifier that will be associated with a rule.</description>
   </AttributeType>
   <AttributeType  name="TOPLEVEL" dt:type="enumeration" dt:values="INACTIVE ACTIVE" default="INACTIVE" required="no">
      <description>Specifies that the rule is a top-level rule. The value, "ACTIVE" or "INACTIVE" specifies whether the rule is to be active by default.</description>
   </AttributeType>
   <AttributeType  name="EXPORT" dt:type="enumeration" dt:values="0 NO FALSE 1 YES TRUE" default="0" required="no">
      <description>Specifies that the rule is exportable (i.e. can be loaded by an external grammar). By default, all grammars are not exportable. Dynamic rules or rules that reference dynamic rules cannot be exported.</description>
   </AttributeType>
   <AttributeType  name="INTERPRETER" dt:type="enumeration" dt:values="0 NO FALSE 1 YES TRUE" default="0" required="no">
      <description>Specifies that the rule should use the CFG-interpreter. See also the interface, ISpCFGInterpreter.</description>
   </AttributeType>
   <AttributeType  name="DYNAMIC" dt:type="enumeration" dt:values="0 NO FALSE 1 YES TRUE" default="0" required="no">
      <description>Specifies that the rule can be updated (dynamically) at runtime by using the ISpGrammarBuilder API.</description>
   </AttributeType>
   <AttributeType  name="PROPNAME" dt:type="string" required="no">
      <description>Specifies the string identifier to be associated with the semantic property (name/value pair).</description>
   </AttributeType>
   <AttributeType  name="PROPID" dt:type="string" required="no">
      <description>Specifies the numeric identifier to be associated with the semantic property (name/value pair).</description>
   </AttributeType>
   <AttributeType  name="VAL" dt:type="string" required="no">
      <description>Specifices the numeric value to be associated with the semantic property (name/value pair).</description>
   </AttributeType>
   <AttributeType  name="VALSTR" dt:type="string" required="no">
      <description>Specifices the string value to be associated with the semantic property (name/value pair).</description>
   </AttributeType>
   <AttributeType  name="PRON" dt:type="string" required="no">
      <description>Specifies the pronunciation for the given phrase tag.</description>
   </AttributeType>
   <AttributeType  name="DISP" dt:type="string" required="no">
      <description>Specifies the display form for the given phrase tag.</description>
   </AttributeType>
   <AttributeType  name="MIN" dt:type="string" default="1" required="no">
      <description> The default value for this is 1. The valid range of values for this is 0 to 255 and must be less than the value specified in MAX. Note:  The value specified by MAX will be used when the specified MIN value is greater than the MAX value.  </description>
   </AttributeType>
   <AttributeType  name="MAX" dt:type="string" default="1" required="no">
      <description> The default value for this is 1. The valid range of values for this is 1 to 255, or indicated by "INF" in text. This value indicates the maximum number of times valid recognitions of this element's contents may be recognized repeatedly. A value "INF" indicates that any number of recognitions may occur. </description>
   </AttributeType>
   <AttributeType  name="WEIGHT" dt:type="float" required="no">
      <description>Specifies the numeric likelihood, or probability, that the transition should be recognized. The combined weights of the transitions leaving a given state should be equal to 1.</description>
   </AttributeType>
   <AttributeType  name="REFID" dt:type="string" required="no">
      <description>Specifies the numeric identifier associated with the rule to be referenced.</description>
   </AttributeType>
   <AttributeType  name="OBJECT" dt:type="string" required="no">
      <description>Specifies the programmatic identifier (ProgID) of the COM object which contains either the CFG interpreter or grammar rule.</description>
   </AttributeType>
   <AttributeType  name="URL" dt:type="string" required="no">
      <description>Specifies the uniform resource locator (URL) address of the grammar to be referenced.</description>
   </AttributeType>
   <!--Definition of GRAMMAR Element -->
   <ElementType  name="GRAMMAR" content="eltOnly" model="closed">
      <description>The top-level XML element containing all other XML elements needed to declare one Command and Control grammar.</description>
      <attribute  type="LANGID"/>
      <attribute  type="WORDTYPE"/>
      <attribute  type="LEXDELIMITER"/>
      <element  type="DEFINE" minOccurs="0" maxOccurs="1"/>
      <element  type="RULE" minOccurs="1" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of DEFINE Element -->
   <ElementType  name="DEFINE" content="eltOnly" model="open">
      <description>The DEFINE tag contains a group of ID tags.</description>
      <element  type="ID" minOccurs="1" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of ID Element -->
   <ElementType  name="ID" content="empty" model="open" order="one">
      <description> The ID tag defines named constants for rule ID, property value, and property ID elements.</description>
      <attribute  type="NAME"/>
      <attribute  type="VAL"/>
   </ElementType>
   <!-- Definition of RULE Element -->
   <ElementType  name="RULE" content="eltOnly" model="open">
      <description> This element describes the non-terminal RULE element. The contents must be non-empty concatenated recognition contents. Left recursion is not legal in a grammar. It is required that either the NAME or ID attribute is specified. If both are specified, then they must agree. All RULE NAMEs and VALs should be unique. Dynamic rules may not be exported.</description>
      <attribute  type="NAME"/>
      <attribute  type="ID"/>
      <attribute  type="TOPLEVEL"/>
      <attribute  type="EXPORT"/>
      <attribute  type="INTERPRETER"/>
      <attribute  type="DYNAMIC"/>
      <group  order="many" minOccurs="0" maxOccurs="*">
         <element type="RULEREF"/>
         <element type="PHRASE"/>
         <element type="P"/>
         <element type="L"/>
         <element type="LIST"/>
         <element type="O"/>
         <element type="OPT"/>
         <element type="TEXTBUFFER"/>
         <element type="WILDCARD"/>
         <element type="DICTATION"/>
         <element type="RESOURCE"/>
      </group>
   </ElementType>
   <!-- Definition of PHRASE Element -->
   <ElementType  name="PHRASE" content="mixed" model="open">
      <description> This element is used to describe the Phrase element. It is a synonym of the P element. An associated property name and value pair will be generated only if the contents of this element are recognized.It is important to note that an empty PHRASE element is not allowed. Attributes may not be empty.</description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <attribute  type="VAL"/>
      <attribute  type="VALSTR"/>
      <attribute  type="PRON"/>
      <attribute  type="DISP"/>
      <attribute  type="MIN"/>
      <attribute  type="MAX"/>
      <attribute  type="WEIGHT"/>
      <element  type="RULEREF" minOccurs="0" maxOccurs="*"/>
      <element  type="PHRASE" minOccurs="0" maxOccurs="*"/>
      <element  type="P" minOccurs="0" maxOccurs="*"/>
      <element  type="L" minOccurs="0" maxOccurs="*"/>
      <element  type="LIST" minOccurs="0" maxOccurs="*"/>
      <element  type="O" minOccurs="0" maxOccurs="*"/>
      <element  type="OPT" minOccurs="0" maxOccurs="*"/>
      <element  type="TEXTBUFFER" minOccurs="0" maxOccurs="*"/>
      <element  type="WILDCARD" minOccurs="0" maxOccurs="*"/>
      <element  type="DICTATION" minOccurs="0" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of P Element -->
   <ElementType  name="P" content="mixed" model="open">
      <description> This element is used to describe the Phrase element. It is a synonym of the PHRASE element. An associated property name and value pair will be generated only if the contents of this element are recognized. It is important to note that a P empty element is not allowed.</description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <attribute  type="VAL"/>
      <attribute  type="VALSTR"/>
      <attribute  type="PRON"/>
      <attribute  type="DISP"/>
      <attribute  type="MIN"/>
      <attribute  type="MAX"/>
      <attribute  type="WEIGHT"/>
      <element  type="RULEREF" minOccurs="0" maxOccurs="*"/>
      <element  type="PHRASE" minOccurs="0" maxOccurs="*"/>
      <element  type="P" minOccurs="0" maxOccurs="*"/>
      <element  type="L" minOccurs="0" maxOccurs="*"/>
      <element  type="LIST" minOccurs="0" maxOccurs="*"/>
      <element  type="O" minOccurs="0" maxOccurs="*"/>
      <element  type="OPT" minOccurs="0" maxOccurs="*"/>
      <element  type="TEXTBUFFER" minOccurs="0" maxOccurs="*"/>
      <element  type="WILDCARD" minOccurs="0" maxOccurs="*"/>
      <element  type="DICTATION" minOccurs="0" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of OPT Element -->
   <ElementType  name="OPT" content="mixed" model="open">
      <description>This element is similar to the PHRASE element. The only difference between the PHRASE element and the OPT element is that the OPT element need not be recognized for the rule to be fired. An associated property name and value pair will be generated only if the contents of this element are recognized. It is a synonym for the O tag.</description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <attribute  type="VAL"/>
      <attribute  type="VALSTR"/>
      <attribute  type="PRON"/>
      <attribute  type="DISP"/>
      <attribute  type="MIN"/>
      <attribute  type="MAX"/>
      <attribute  type="WEIGHT"/>
      <element  type="RULEREF" minOccurs="0" maxOccurs="*"/>
      <element  type="PHRASE" minOccurs="0" maxOccurs="*"/>
      <element  type="P" minOccurs="0" maxOccurs="*"/>
      <element  type="L" minOccurs="0" maxOccurs="*"/>
      <element  type="LIST" minOccurs="0" maxOccurs="*"/>
      <element  type="O" minOccurs="0" maxOccurs="*"/>
      <element  type="OPT" minOccurs="0" maxOccurs="*"/>
      <element  type="TEXTBUFFER" minOccurs="0" maxOccurs="*"/>
      <element  type="WILDCARD" minOccurs="0" maxOccurs="*"/>
      <element  type="DICTATION" minOccurs="0" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of O Element -->
   <ElementType  name="O" content="mixed" model="open">
      <description>This element is similar to the P element. The only difference between the PHRASE element and the OPT element is that the OPT element need not be recognized for the rule to be fired. An associated property name and value pair will be generated only if the contents of this element are recognized. It is a synonym for the OPT tag. </description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <attribute  type="VAL"/>
      <attribute  type="VALSTR"/>
      <attribute  type="PRON"/>
      <attribute  type="DISP"/>
      <attribute  type="MIN"/>
      <attribute  type="MAX"/>
      <attribute  type="WEIGHT"/>
      <element  type="RULEREF" minOccurs="0" maxOccurs="*"/>
      <element  type="PHRASE" minOccurs="0" maxOccurs="*"/>
      <element  type="P" minOccurs="0" maxOccurs="*"/>
      <element  type="L" minOccurs="0" maxOccurs="*"/>
      <element  type="LIST" minOccurs="0" maxOccurs="*"/>
      <element  type="O" minOccurs="0" maxOccurs="*"/>
      <element  type="OPT" minOccurs="0" maxOccurs="*"/>
      <element  type="TEXTBUFFER" minOccurs="0" maxOccurs="*"/>
      <element  type="WILDCARD" minOccurs="0" maxOccurs="*"/>
      <element  type="DICTATION" minOccurs="0" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of L Element -->
   <ElementType  name="L" content="eltOnly" model="open">
      <description>Defines an expression of alternate phrase recognitions. Each subelement represents a possible separate recognition in place of this element. It is a synonym of the LIST tag. Emply elements are not valid (i.e. the tag must have children). The LIST element can define a default property name (PROPNAME) or id (PROPID) which will be inherited by it's child PHRASE elements.</description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <element  type="RULEREF" minOccurs="0" maxOccurs="*"/>
      <element  type="PHRASE" minOccurs="0" maxOccurs="*"/>
      <element  type="P" minOccurs="0" maxOccurs="*"/>
      <element  type="L" minOccurs="0" maxOccurs="*"/>
      <element  type="LIST" minOccurs="0" maxOccurs="*"/>
      <element  type="TEXTBUFFER" minOccurs="0" maxOccurs="*"/>
      <element  type="WILDCARD" minOccurs="0" maxOccurs="*"/>
      <element  type="DICTATION" minOccurs="0" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of LIST Element -->
   <ElementType  name="LIST" content="eltOnly" model="open">
      <description>Defines an expression of alternate phrase recognitions. Each subelement represents a possible separate recognition in place of this element. It is a synonym of the L tag. Emply elements are not valid (i.e. the tag must have children). The LIST element can define a default property name (PROPNAME) or id (PROPID) which will be inherited by it's child PHRASE elements.</description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <element  type="RULEREF" minOccurs="0" maxOccurs="*"/>
      <element  type="PHRASE" minOccurs="0" maxOccurs="*"/>
      <element  type="P" minOccurs="0" maxOccurs="*"/>
      <element  type="L" minOccurs="0" maxOccurs="*"/>
      <element  type="LIST" minOccurs="0" maxOccurs="*"/>
      <element  type="TEXTBUFFER" minOccurs="0" maxOccurs="*"/>
      <element  type="WILDCARD" minOccurs="0" maxOccurs="*"/>
      <element  type="DICTATION" minOccurs="0" maxOccurs="*"/>
   </ElementType>
   <!-- Definition of RULEREF Element -->
   <ElementType  name="RULEREF" content="empty" model="open">
      <description>This element describes the RULEREF tag which is non-terminal.  It is used inside the contents of a rule definition (RULE) to reference another defined rule. The RULEREF tag may contain a semantic property (name/value pair) which will be returned if the rule is recognized.</description>
      <attribute  type="NAME"/>
      <attribute  type="REFID"/>
      <attribute  type="OBJECT"/>
      <attribute  type="URL"/>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <attribute  type="VAL"/>
      <attribute  type="VALSTR"/>
      <attribute  type="WEIGHT"/>
   </ElementType>
   <!-- Definition of DICTATION Element -->
   <ElementType  name="DICTATION" content="empty" model="open">
      <description>Specifies that the recognized phrase should match at least MIN and at most MAX words from the dictation grammar. The DICTATION tag may contain an associated semantic tag (name/value pair) which will be returned if the DICTATION tag is recognized.</description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <attribute  type="MIN"/>
      <attribute  type="MAX"/>
   </ElementType>
   <!-- Definition of RESOURCE Element -->
   <ElementType  name="RESOURCE" content="empty" model="open">
      <description> Specifies the grammar node is a grammar located in a standard Windows Resource grammar.</description>
      <attribute  type="NAME"/>
   </ElementType>
   <!-- Definition of TEXTBUFFER Element -->
   <ElementType  name="TEXTBUFFER" content="empty" model="open">
      <description>Specifies the grammar is from a text buffer, to be specified at runtime by the application. See also ISpRecoGrammar::SetWordSequenceData and ISpRecoGrammar::SetTextSelection.</description>
      <attribute  type="PROPNAME"/>
      <attribute  type="PROPID"/>
      <attribute  type="WEIGHT"/>
   </ElementType>
   <!-- Definition of WILDCARD Element -->
   <ElementType  name="WILDCARD" content="empty" model="open">
      <description>Specifies a garbage word identifier for one or more non-silence sounds. The garbage word may be recognized by the Speech Recognition engine, but will NOT be returned to the application.</description>
   </ElementType>
</Schema>
