PRB: Parsing XML Containing Invalid Character May Raise ArgumentException (325694)
The information in this article applies to:
- Microsoft .NET Framework Class Libraries 1.0
- Microsoft .NET Framework Class Libraries 1.1
This article was previously published under Q325694 SYMPTOMS
When you load XML in an XmlDocument object, and the XML contains an invalid character, an exception is raised. The exception may be an XmlException or an ArgumentException, depending on what the invalid character is. For example, if the XML contains 0x13, an XmlException is reported. If the XML contains 0xE9, and the document encoding is US-ASCII, an ArgumentException is reported.
CAUSE
The exceptions are raised for the following two reasons:
- 0x13 is outside the valid range of XML characters, therefore an XmlException is raised. The following are valid characters:
#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
- 0xE9 is a valid XML character, however, it is beyond the range that is defined by the US-ASCII encoding. Therefore, an ArgumentException is raised.
STATUSThis behavior is by design.
Modification Type: | Major | Last Reviewed: | 1/22/2004 |
---|
Keywords: | kbprb kbXML KB325694 kbAudDeveloper |
---|
|