SSMLVerifier will verify that a given input is valid SSML. It is based of a javascript implementation found here: https://github.com/gsdriver/ssml-check
This is a WIP project. Here is the current state of the implementation:
The basic usage looks like this:
const string testSsml = "<speak>Hello <break strength='weak' time='1s'/> World!</speak>";
var verifier = new Verifer();
var errors = verifier.Verify(testSsml);
if(errors.Count() == 0)
{
Console.WriteLine("SSML is valid!");
}
else
{
foreach(var error in errors)
{
Console.WriteLine(error.Error);
}
}
But I'd recommend you to use the second parameter aswell, which sets the target platform.
verifier.Verify(testSsml, SsmlPlatform.Amazon);
// or ...
verifier.Verify(testSsml, SsmlPlatform.Google);
This way you are able to use platform specific tags like Amazon's lang
-tag
// lang is an amazon-specific tag
const string testSsml = "<speak>Hello <lang xml:lang='de-DE'>Welt</lang></speak>";
var verifier = new Verifer();
// this will fail, because lang is a Amazon-specific tag
var result = verifier.Verify(testSsml, SsmlPlatform.Google);