none
Loading Grammar From String Not File RRS feed

  • Question

  • All:

    Is it possible to load a fully composed grxml grammar from a string and not a file.  The following will load grxml files

    string _srgsDocumentFile = Path.Combine("c:\\", "test.grxml");
    _srgsDocument = new SrgsDocument(_srgsDocumentFile);
     _host.TelephonySession.SpeechRecognizer.LoadGrammarAsync(new Grammar(_srgsDocument, "test"));

    however, is it possible to load via a string like:

    string _textString = ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                                   "<grammar version=\"1.0\"" +
                                   "xml:lang=\"en-US\"" +
                                   "mode=\"voice\"" +
                                   "xmlns=\"http://www.w3.org/2001/06/grammar\"" +
                                   "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
                                   "xsiTongue TiedchemaLocation=\"http://www.w3.org/2001/06/grammar " +
                                   "http://www.w3.org/TR/speech-grammar/grammar.xsd\"" +
                                   "root=\"test\">\n" +
                                   "<rule id=\"test\" scope=\"public\">" +
                                   "<one-of>" +
                                   "<item>please</item>" +
                                   "<item>maam</item>" +
                                   "</one-of>" +
                                   "</rule>" +
                                   "</grammar>");
    Tuesday, August 12, 2008 10:50 PM

Answers