PromptBuilder.ToXml Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne le SSML généré à partir de l’objet PromptBuilder .
public:
System::String ^ ToXml();
public string ToXml();
member this.ToXml : unit -> string
Public Function ToXml () As String
Retours
Retourne le SSML généré à partir de l’objet PromptBuilder sous la forme d’une seule ligne.
Exemples
L’exemple suivant crée un objet, ajoute du PromptBuilder texte, puis écrit l’équivalent SSML de l’invite dans la console avant de parler du contenu de l’invite.
using System;
using System.Speech.Synthesis;
namespace SampleSynthesis
{
class Program
{
static void Main(string[] args)
{
// Initialize a new instance of the SpeechSynthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Configure the audio output.
synth.SetOutputToDefaultAudioDevice();
// Create a PromptBuilder object and add content.
PromptBuilder style = new PromptBuilder();
style.AppendText("Your order for");
style.StartStyle(new PromptStyle(PromptRate.Slow));
style.AppendText("one kitchen sink and one faucet");
style.EndStyle();
style.AppendText("has been confirmed.");
// Write the contents of the PromptBuilder object to the console as
// an SSML-compatible XML file.
string myXml = style.ToXml();
Console.WriteLine("This is the SSML equivalent of the PromptBuilder: \n\n" + myXml);
// Speak the contents of the SSML prompt.
synth.Speak(style);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
Remarques
La ToXml méthode n’essaie pas de mettre en forme le SSML retourné de quelque manière que ce soit.