oracle xml 解析给出无效字符错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1308033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
oracle xml parsing gives invalid character error
提问by
I am using Oracle 11G sql developer's Export Utility to convert the tabular data into XML. To do so, I have used utf-8 encoding. The special characters (0x13) which i see in DB as square boxes, have come into xml as it is. To get rid of this special character, do we need to select some other encoding in Sql Developer?
我正在使用 Oracle 11G sql 开发人员的导出实用程序将表格数据转换为 XML。为此,我使用了 utf-8 编码。我在 DB 中看到的特殊字符 (0x13) 是方框,已按原样进入 xml。为了去掉这个特殊字符,我们是否需要在Sql Developer中选择一些其他的编码?
The problem I am facing is, 'xml parsing failed' while I try to insert the above created xml file into different Oracle table (using xmltable function ). I get the below error.
我面临的问题是,当我尝试将上面创建的 xml 文件插入不同的 Oracle 表(使用 xmltable 函数)时,“xml 解析失败”。我收到以下错误。
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00216: invalid character 0 (0x13)
Error at line 10682
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
ORA-06512: at line 9
If I remove the special characters from xml file manually, it started working fine. But I would like to get this working without removing them.
如果我手动从 xml 文件中删除特殊字符,它开始工作正常。但我想让它工作而不删除它们。
回答by Mayur
You can remove the special character via the REPLACE
function - just replace CHR(13) via a blank:
您可以通过该REPLACE
功能删除特殊字符- 只需通过空白替换 CHR(13) :
REPLACE(arg1, CHR(13), '');
回答by Steve R
You can remove all spl chars using the Oracle supplied function dbms_xmlgen.convert(...)
您可以使用 Oracle 提供的函数删除所有 spl 字符dbms_xmlgen.convert(...)
dbms_xmlgen.convert(arg1)