PRB: You Receive XmlTextReader Error Message When Colon Appears in Processing Instruction (318351)
The information in this article applies to:
- Microsoft XML Classes (included with the .NET Framework 1.0)
This article was previously published under Q318351 The following .NET Framework Class LIbrary namespace is
referenced in this aritcle:
System.XML SYMPTOMS If you use the XmlTextReader to read an Extensible Markup Language (XML) document, and the
document contains a processing instruction with a colon, you may receive the
following error message: 'xml:stylesheet' is an invalid
name for a processing instruction. Line 1, position 3. CAUSEThis
behavior is by design.RESOLUTION To work around this problem, do one of the following:
- Do not use colon in the processing instruction. Instead,
use a hyphen. Both Microsoft and W3C recommend this method:
<?xml:stylesheet ...?> should be changed to <?xml-stylesheet ...?>
For more information about the W3C recommendation, browse to the
following W3C Web site: - If you cannot change the XML, turn off the namespace on XmlTextReader before you read the XML, and then set the namespace back to its
original value after you finish reading:
//before calling read, set
XmlTextReader.Namespace = false
//after you have read, set
XmlTextReader.Namespaces=true
Modification Type: | Major | Last Reviewed: | 9/17/2003 |
---|
Keywords: | kbprb KB318351 |
---|
|