dom4j解析xml报错:Nested exception: org.xml.sax.SAXParseException: White space is required between the processing instruction target and data.
采用dom4j方式解析string类型的xml
xml: String string="<?xmlversion=\"1.0\" encoding=\"UTF-8\"?><ROOT><HEAD><INFO><BUSINESSNO>T065205072015000097</BUSINESSNO><BUSINESSTYPE>T</BUSINESSTYPE></INFO></HEAD></ROOT>";
时,报错:Nested exception: org.xml.sax.SAXParseException: White space is required between the processing instruction target and data.
后来发现原来是xml格式有误。xmlversion应改为xml version.即xml和version之间应该有一个空格。
改为
string="<?xml version=\"1.0\" encoding=\"UTF-8\"?><ROOT><HEAD><INFO><BUSINESSNO>T065205072015000097</BUSINESSNO><BUSINESSTYPE>T</BUSINESSTYPE></INFO></HEAD></ROOT>";就OK了。
dom4j解析xml报错:Nested exception: org.xml.sax.SAXParseException: White space is required between the processing instruction target and data.的更多相关文章
- xml操作-Nested exception: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId. 异常处理
异常如下: org.dom4j.DocumentException: Error on line 2 of document file:///D:/workspaces/struts2/lesson0 ...
- springboot 报错nested exception is java.lang.IllegalStateException: Failed to check the status of the service xxxService No provider available for the service
spring: dubbo:#关闭所有服务的启动时检查:(没有提供者时报错) consumer: check: false timeout: 3000
- java运行报错:nested exception is java.lang.NoSuchFieldError: INSTANCE,但使用@Test测试是好的
解决方法: 原因是,在tomcat里,同名不同版本的jar包,默认加载版本低的.我项目里有两个httpclient jar包.一个4.2.5 另一个是4.5.所以加载了4.2.5的,而我要用的是4. ...
- org.dom4j.DocumentException: unknown protocol: d Nested exception: unknown
最近用dom4j写了一个修改XML文件的小例子,抛出了如下异常: org.dom4j.DocumentException: unknown protocol: d Nested exception: ...
- SSM——[/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; cvc-elt.1: 找不到元素 'beans' 的声明。
报错文件:/SSM_Integration/WebContent/WEB-INF/applicationContext.xml <beans xmlns="http://www.spr ...
- (转)解决dubbox-demo-provider.xml报错的问题:提示Failed to read schema document
背景:在eclipse项目中,经常会遇到xml文件提示找不到.xsd文件的情况.很有必要弄清xsd文件的加载过程! 1 解决过程 dubbo-demo-provider导入eclipse后dubbox ...
- eclipse新建maven项目出错 pom.xml报错
问题: 1.新建项目后会提示一个这样的错 maven-compiler-plugin:3.1:compile(1 errors) maven-compiler-plugin:3.1:testCompi ...
- web.xml文件报错:The processing instruction target matching "[xX][mM][lL]" is not allowed.
昨晚把我的项目上传到了gitlab,然后今天在公司从gitlab下载下来, 发现web.xml报错.
- android 程序中res/values-v14/styles.xml报错的解决办法
从旧的ADT迁移的新的ADT时, android 程序中res/values-v14/styles.xml报错: error: Error retrieving parent for item: No ...
随机推荐
- ubuntu14.04禁止触摸板和恢复触摸板
1.使用xinput list查看与触摸板相关的id,以下是本机的输出,没搞清楚为什么是Mouse!!! jello@jello:~$ xinput list⎡ Virtual core pointe ...
- sql server文件另存为的时候,选择文件编码和换行
文件编码 使用code page来标记的,没有找到utf8 without bom 换行
- 【lrzsz 】Linux安装上传下载功能
1.在线安装服务 # yum -y install lrzsz 2.上传 rz 3.下载 sz
- dp专题训练
****************************************************************************************** 动态规划 专题训练 ...
- java 类构造器中加入有参构造器及调用顺序【思路】
package com.ykmimi.new1; /** * * @author deadzq * */ public class AnyThing { public AnyThing() { thi ...
- C#学习笔记(一):C#简介
计算机语言计算机语言是指用于人与计算机之间通讯的语言机器码——汇编语言——高级语言(面向过程(线性).面向对象(类).面向组件(Unity)) 一.计算机语言发展趋势1.简单:代码生成逻辑2.面向人类 ...
- MVC ---- EF批处理
#region 批处理 ///<summary> ///两增一删一改 ///</summary> public void Save(){ //新增参一 Parameter pa ...
- GATK--使用转载
http://blog.sciencenet.cn/blog-1469385-819498.html 文章目录 一.准备工作 二.流程概览 三.流程 首先说说GATK可以做什么.它主要用于从seque ...
- CRLF line terminators导致shell脚本报错:command not found --转载
Linux和Windows文本文件的行结束标志不同.在Linux中,文本文件用"/n"表示回车换行,而Windows用"/r/n"表示回车换行.有时候在Wind ...
- elementUI和iview兼容么
听说iview的作者居然是91年的,我要赶快加油了. https://zhuanlan.zhihu.com/p/25739512