c# - 无效的 XML 注释 : invalid character

标签 c# xml documentation

XML comment contains invalid XML: A name was started with an invalid character

这是我收到的 IntelliSense 文档消息。我的文档显然有问题,但我找不到什么。

    /// <summary>
    /// The local-part of an email adress may use any of these ASCII characters (As according to RFC 5322 <see href="http://tools.ietf.org/html/rfc5322"></see>):
    /// - Uppercase and lowercase English letters (a–z, A–Z) (ASCII: 65-90, 97-122)
    /// - Digits 0 to 9 (ASCII: 48-57)
    /// - Characters !#$%&'*+-/=?^_`{|}~ (ASCII: 33, 35-39, 42, 43, 45, 47, 61, 63, 94-96, 123-126)
    /// - Character . (dot, period, full stop) (ASCII: 46) provided that it is not the first or last character, and provided also that it does not appear two or more times consecutively (e.g. John..Doe@example.com is not allowed.)
    /// - Special characters are allowed with restrictions. They are: Space and "(),:;<>@[\] (ASCII: 32, 34, 40, 41, 44, 58, 59, 60, 62, 64, 91-93)
    /// - The restrictions for special characters are that they must only be used when contained between quotation marks, and that 3 of them (The space, backslash \ and quotation mark " (ASCII: 32, 92, 34)) must also be preceded by a backslash \ (e.g. "\ \\\"").
    /// </summary>

我的猜测是它与所有角色有关,但我真的不知道......

最佳答案

在这一行:

 /// - Special characters are allowed with restrictions. They are: Space and "(),:;<>@[\] (ASCII: 32, 34, 40, 41, 44, 58, 59, 60, 62, 64, 91-93)

<字符将被解释为 Xml 标记的开始(和 > 作为结束)。将这些替换为 &lt;&gt;分别。您可能还需要转义其他字符,例如 &&amp; .

Here is a comprehensive list Xml/Html 字符实体。

关于c# - 无效的 XML 注释 : invalid character,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19398635/

相关文章:

c# - ReSharper - 条件编译 XML 注释错误

c# - 使用 Interop Excel 时,SSIS 脚本任务断点不起作用

c# - Excel 自动化 C# : How to delete multiple rows?

c# - TempData、ViewBag,没有任何作用

objective-c - iPhone开发-生成XML文件

java - XMLUnit - NodeFilter 不返回任何内容

javascript - 从字符串中清除 CDATA

c++ - 是否有一个工具来解析强制文档的 C++

documentation - Symfony2 的简单示例

c# - 如何在 Windows 7 上静默安装 Postgresql