Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SrgsDocument Constructor (XmlReader)

Initializes a new instance of the SrgsDocument class from an instance of XmlReader that references an XML-format grammar file.

Namespace:  Microsoft.Speech.Recognition.SrgsGrammar
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

'Declaration
Public Sub New ( _
    srgsGrammar As XmlReader _
)
'Usage
Dim srgsGrammar As XmlReader

Dim instance As New SrgsDocument(srgsGrammar)
public SrgsDocument(
    XmlReader srgsGrammar
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

srgsGrammar is a null reference (Nothing in Visual Basic).

Examples

The following example creates a new instance of SrgsDocument from an instance of XmlReader that references the file "srgsDocumentFile.xml".

string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");
SrgsDocument document = null;

if (File.Exists(srgsDocumentFile))
{
  XmlReader reader = XmlReader.Create(srgsDocumentFile);
  document = new SrgsDocument(reader);
  reader.Close();
}

See Also

Reference

SrgsDocument Class

SrgsDocument Members

SrgsDocument Overload

Microsoft.Speech.Recognition.SrgsGrammar Namespace