Hi Haiwen,
Thank you for using MSDN Newsgroup! My name is Jeffrey, and I will be
assisting you on this issue.
Based on my understanding, there is <temperature> 150¡ãF</temperature> in
your xml file, when you use DataSet.ReadXml method to read this xml file,
"invalid character" error generate.
====================
Based on my research, the problem may occur if your xml file was saved with
encoding type: ANSI.
Because your "150¡ãF" characters are Unicode encoded, while stored as ANSI,
you can not read it correctly.
You can try the following Steps/ Solution to see if it helps resolve your
issue:
1). Use NotePad.exe to open your xml file
2). Use "Save As" menu option
3). In the "Save As" dialog box, choose Encoding type: Unicode
4). Save your xml as a new xml file name, such as newxml.xml
Then I think your application can read this xml file correctly(Because .Net
default use Unicode encoding way to read xml file)
Please apply my suggestion above and let me know if it helps resolve your
problem.
====================
For further information, in the xml file's declaration node, you can
specify your xml file's encoding way, such as:
<?xml version="1.0" encoding="UTF-16" ?>
You can use .Net class XmlDeclaration to manipulate the XML declaration
node.
XmlDeclaration has a property Encoding can Gets or sets the encoding level
of the XML document, please refer to:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemXmlXmlDeclarat
ionClassEncodingTopic.asp
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.