编码以数字开头的 XML 元素名称? [英] Encoding XML element name beginning with a number?
问题描述
我正在查看工具的输出,将数据库表转储到 XML.其中一列名为 64kbit ,该工具对其进行编码,我需要复制它:
I'm looking at the output of a tool, dumping a database table to XML. One of the columns is named 64kbit , the tool encodes that as such, and I need to replicate that:
<_x0036_4kbit>0</_x0036_4kbit>
这是某种标准编码吗?我在哪里可以了解更多信息?
Is this some sort of standard encoding ? Where can I learn more about it ?
推荐答案
好吧,这似乎不太标准,但 XML 明确不允许将数字(和其他一些东西)作为元素名称的第一个字符:
Well, it doesn't seem to be too standard, but XML explicitly disallows numbers (and some other things) as the first character of an element name:
NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] |
[#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] |
[#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] |
[#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] |
[#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
如果不符合要求,这里的编码只是对第一个字符进行转义.它使用该字符的十六进制值._x0036_
显然对应的是十六进制的0x36
,也就是十进制的54
,代表数字6
.
This encoding here just kinda escapes the first character if it doesn't fit that requirements. It uses the hexadecimal value of that character. _x0036_
obviously corresponds to hexadeximal 0x36
which is 54
in decimal and represents the digit 6
.
这篇关于编码以数字开头的 XML 元素名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!