Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid XML comment: invalid character

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

This is the IntelliSense documentation message I get. Something is obviously wrong with my documentation but I can't find what.

    /// <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. [email protected] 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>

My guess is that it has something to do with all the characters, but I dunno really...

like image 376
user1021726 Avatar asked Oct 16 '13 08:10

user1021726


People also ask

What is an invalid XML character?

RuntimeException: An invalid XML character (Unicode: 0x0) was found in the element content: This error occurs while you are performing data transformations within your broker, either for an XSLT or to enable monitoring or tracing of the data stream, and results in a flow failure.

What characters are not supported in XML?

The only illegal characters are & , < and > (as well as " or ' in attributes, depending on which character is used to delimit the attribute value: attr="must use &quot; here, ' is allowed" and attr='must use &apos; here, " is allowed' ). They're escaped using XML entities, in this case you want &amp; for & .

How do I find an invalid XML character?

If you're unable to identify this character visually, then you can use a text editor such as TextPad to view your source file. Within the application, use the Find function and select "hex" and search for the character mentioned. Removing these characters from your source file resolve the invalid XML character issue.

What is an invalid character?

The message, described as an invalid character error, typically is the result of a common syntax mistake. The cause, according to Oracle docs, can be from starting identifiers with ASCII (American Standard Code) that are not letters or numbers.


1 Answers

On this line:

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

The < character will be interpreted as the start of an Xml tag (and > as an end). Replace these with &lt; and &gt; respectively. You will also perhaps needs to escape other characters such as & with &amp;.

Here is a comprehensive list of Xml/Html character entities.

like image 59
Moo-Juice Avatar answered Nov 15 '22 21:11

Moo-Juice