发生 System.Xml.XmlException。名称不能以“'G'”开头字符,十六进制值 0xFF27。 44 号线,位置 4
我编写了一段代码来读取包含日语字符的 xml 文件。 读取 xml 文件的代码是:
DataSet xmlData = new DataSet();
xmlData.ReadXml("c:\\abc.xml");
但是在执行此代码时,由于 xml 文件包含英文字符 'G' 第 44 行,发生异常 'System.Xml.XmlException'。
显示的错误消息是: ="Name 无法开始带有“G”字符,十六进制值 0xFF27,第 44 行,位置 4。”
我该如何解决这个问题。? 我的 xml 文件详细信息(包括编码描述)如下所示。
<?xml version="1.0" encoding="UTF-16" ?>
提前致谢, 比乔伊。
I have written a code to read an xml file which contains Japanese characters.
Code written to read the xml file is:
DataSet xmlData = new DataSet();
xmlData.ReadXml("c:\\abc.xml");
But while executing this code an exception 'System.Xml.XmlException' is occurring since the xml file contains an English character 'G' Line 44.
the Error message shown is: ="Name cannot begin with the 'G' character, hexadecimal value 0xFF27. Line 44, position 4."
How can I solve this.??
My xml file details including encoding description are given below.
<?xml version="1.0" encoding="UTF-16" ?>
Thanks in Advance,
Bijoy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个全宽拉丁文大写字母 G,而不是普通字母。
将其替换为普通的
G
。That's a FULLWIDTH LATIN CAPITAL LETTER G, not a normal letter.
Replace it with a normal
G
.0xFF27 是全角拉丁字母“G”,与拉丁字母“G”不同。您应该使用拉丁字母(在 ASCII 范围内)而不是全角字母(在 FF01-FF5E 范围内)。如果 XML 不是太大,只需使用英文键盘并一一替换所有字母。
0xFF27 is full-width Latin letter 'G', which is not the same as Latin letter 'G'. You should use latin letters (in ASCII range) instead of full-width letters (in range FF01-FF5E). If XML is not too large the just use english keyboard and replace all letters, one by one.