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
Visual Basic (Declaration) |
---|
Public Sub New ( _ srgsGrammar As XmlReader _ ) |
Visual Basic (Usage) |
---|
Dim srgsGrammar As XmlReader Dim instance As New SrgsDocument(srgsGrammar) |
C# |
---|
public SrgsDocument( XmlReader srgsGrammar ) |
Parameters
- srgsGrammar
- Type: System.Xml..::..XmlReader
The XmlReader that was created with the SrgsDocument XML instance.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | srgsGrammar is nullNothingnullptrunita 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".
C# | Copy Code |
---|---|
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();
} |