SrgsDocument Constructor (XmlReader)

Microsoft Speech Platform SDK 11

Collapse imageExpand ImageCopy imageCopyHover image

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

ExceptionCondition
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 imageCopy 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();
}

See Also