以XML名称编码空格字符 [英] Encoding space character in XML name

查看:209
本文介绍了以XML名称编码空格字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个包含如下名称的XML文件:

I am given an XML file which contains names like below:

<Benchↂ0020Codeↂ0020>something</Benchↂ0020Codeↂ0020>

ↂ符号用三个字节表示:0xE2、0x86、0x82。

The ↂ symbol is represented with three bytes: 0xE2, 0x86, 0x82.

看起来ↂ0020应该被视为空格字符。但是当我使用System.Xml.XmlReader读取XML时,字符ↂ0020不会转换为空格。

It looks like ↂ0020 is supposed to be treated as space character. But when I read the XML using System.Xml.XmlReader the characters ↂ0020 are not converted to space.

是否有一种方法可以将它们转换(除了替换,课程)?还是我刚弄破XML?

Is there is a way to have them converted (besides replacing, of course)? Or I just got broken XML?

推荐答案

XML并未损坏,但它使用私有约定来表示名称,以转义不允许的字符。 XML解析器无法理解该约定,这取决于接收应用程序对其进行解释。

The XML isn't broken, but it's representing names using a private convention for escaping disallowed characters. The XML parser won't understand this convention, it's up to the receiving application to interpret it.

这篇关于以XML名称编码空格字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆