发生 System.Xml.XmlException。名称不能以“'G'”开头字符,十六进制值 0xFF27。 44 号线,位置 4

发布于 2024-10-03 22:19:26 字数 448 浏览 0 评论 0原文

我编写了一段代码来读取包含日语字符的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白衬杉格子梦 2024-10-10 22:19:26

这是一个全宽拉丁文大写字母 G,而不是普通字母。

将其替换为普通的G

That's a FULLWIDTH LATIN CAPITAL LETTER G, not a normal letter.

Replace it with a normal G.

风情万种。 2024-10-10 22:19:26

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文