xmlsapissml

XmlException: Character '=' may not be contained within a name


SAPI5 in combination with the flag SVSFIsXML allows inserting custom tags, for example in such a form:

 <customtag>Speak this text</customtag>

This tag would be recognized as

FragList->State.eAction == SPVA_ParseUnknownTag

However, when I use the new standard SSML, the following XML code raises the error

Invalid XML content:
Inner Exception: XmlException: The character '=' (hex value 0x3D) may not be contained within a name. Line 1, position 126.

This is the code:

<speak version='1.0' xmlns="http://www.w3.org/2001/10/synthesis" xml:lang='en-US'>
<voice name='Microsoft Sam'>
<customtag="1">
 Speak this text!
</customtag>
</voice>
</speak>

And the following XML code raises a different error:

System.FormatException: The element "customtag" is invalid.

This is the code:

<speak version='1.0' xmlns="http://www.w3.org/2001/10/synthesis" xml:lang='en-US'>
<voice name='Microsoft Sam'>
<customtag>
 Speak this text!
</customtag>
</voice>
</speak>

If I remove the customtag, it works fine.

Is there any obvious XML error in my code, or does using custom tags simply not work anymore?

Thank you.


Solution

  • Is there any obvious XML error in my code

    <customtag="1"> is an obvious error. Element names are not attributes and can't have values.

    or does using custom tags simply not work anymore?

    The whole point of XML is to allow custom markup languages to be designed.

    You appear to have a Speech Synthesis document, which uses a custom markup language designed using XML.

    The 'The element "customtag" is invalid ' error message says that customtag is not allowed in a Speech Synthesis document.

    It is possible to design a Speech Synthesis + Something Else markup language, but your tool isn't testing for that. It is requiring a pure Speech Synthesis document.