Dom4j 读 xml 时,遇到 xml 无效字符,报错:An invalid XML character
来源:互联网 发布:初中英语课文朗读软件 编辑:程序博客网 时间:2024/06/05 10:09
它说xml有无效字符,然后找一下,xml 的无效字符有那些,它有三段,官方定义的无效字符为:
- 0x00 - 0x08
- 0x0b - 0x0c
- 0x0e - 0x1f
1:
str.replaceAll("[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]", "");
2:
public static String filter(String xmlStr) { StringBuilder sb = new StringBuilder(); char[] chs = xmlStr.toCharArray(); // System.out.println("filter before=" +chs.length); for (char ch : chs) { if ((ch >= 0x00 && ch <= 0x08) || (ch >= 0x0b && ch <= 0x0c) || (ch >= 0x0e && ch <= 0x1f)) { } else { sb.append(ch); } } // System.out.println("filter after=" +sb.length()); return sb.toString(); }
- Dom4j 读 xml 时,遇到 xml 无效字符,报错:An invalid XML character
- Dom4j 读 xml 时,遇到 xml 无效字符,报错:An invalid XML character
- hexadecimal value 0x0C, is an invalid character-如何去除XML无效字符
- SAXParseException An invalid XML character 问题的解决
- XML解析出现An invalid XML character (Unicode: 0x**) was found in the comment.
- org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x7)
- XML解析出现An invalid XML character (Unicode: 0x**) was found in the comment.
- XML解析出现An invalid XML character (Unicode: 0x**) was found in the comment.
- org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x7)
- XML解析出现An invalid XML character (Unicode: 0x**) was found in the comment.
- Error parsing XML: An invalid XML character (Unicode:0x1f) was found
- XML解析出现An invalid XML character (Unicode: 0x**) was found in the comment.
- linux weblogic dom4j报解析GBK编码的xml时 报错无效的encoding gbk 解决方法
- XML无效字符过滤
- dom4j解析xml时遇到的问题
- XML SCHEMA 报错:Invalid content
- 操作XML 报错:根级别上的数据无效 和 给定编码中的字符无效
- All About JAVA An invalid XML character (Unicode: 0xdd65) was found in the comment 错误
- jquery的选中
- 2-3树删除和插入操作的小结
- 默然日记20121210
- SGI_STL_空间配置器
- C# 编译 数据采集器。
- Dom4j 读 xml 时,遇到 xml 无效字符,报错:An invalid XML character
- oracle用户登录密码过期的修改
- cron linux定时执行
- tomcat报错access denied
- FreeMarker基本数据类型
- PMON命令列表
- NSBundle的最佳解释
- [Silverlight入门系列]使用MVVM模式(1):MVVM核心概念
- Android内存溢出的解决方法