无效的XML注释:无效字符

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

这是我收到的智能感知文档信息。我的文档显然存在问题,但我找不到原因。

    /// <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, AZ) (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>

我的猜测是它与所有字符有关,但我真的不确定...

1个回答

17

在这一行上:

 /// - 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; 转义 &

这里是一个全面的Xml / Html字符实体列表。


谢谢,现在可以了!当它允许我时,我会在2分钟内接受它 :) - user1021726

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接