十六进制 0X19 是无效字符 [英] hexadecimal 0X19 is an invalid character
问题描述
所以,
我正在使用 XMLWriter 根据数据集中的值构建 XML 字符串.
I am building XML string based on the values from the dataset using XMLWriter.
它按照我指定的设置和条件正确构建了 xml 字符串.
It is properly building the xml string as per the settings and the conditions I specified.
如果数据集中的记录超过 1000 条,并且当我尝试构建 xml 字符串时,我会收到上述错误.十六进制 0X19 是无效字符
If there are more than 1000 records in the dataset and when I try to build the xml string I am getting the above error. hexadecimal 0X19 is an invalid character
我如何通过这个.我花了大约 6 个小时试图弄清楚.
How do I get pass this. I have spent around 6 hrs trying to figure out.
请帮忙
推荐答案
很简单,无论您如何标记,都不允许在 XML 文档中使用该字符.引用规范:
Quite simply, you're not allowed that character in an XML document, no matter how you mark it up. To quote the spec:
字符 ::= #x9 |#xA |#xD |[#x20-#xD7FF] |[#xE000-#xFFFD] |[#x10000-#x10FFFF]
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
粗略翻译,这意味着在 0x20 之前,您只允许使用制表符 (0x09)、换行符 (0x0a) 和回车符 (0x0d).
Roughly translated, that means that before 0x20, you're only allowed tab (0x09), newline (0x0a) and carriage return (0x0d).
解决此类问题的常规方法是使用另一种嵌入式编码,例如 base64.
The normal way to overcome this sort of issue to use another, embedded, encoding like base64.
这篇关于十六进制 0X19 是无效字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!