问题描述
- 获取传输回来的xml转换出现问题
-
in = conn.getInputStream(); Document document=(Document) new SAXBuilder().build(in); 这里出现 jdom 转dom4j 报错 org.jdom.Document cannot be cast to org.dom4j.Document
解决方案
org.jdom.Document respJdom = (org.jdom.Document) new SAXBuilder().build(in);
DOMOutputter outputter = new DOMOutputter();
org.w3c.dom.Document respW3c=outputter.output(respJdom);
org.dom4j.io.DOMReader xmlReader=new org.dom4j.io.DOMReader();
Document resp= xmlReader.read(respW3c);
时间: 2024-12-27 12:49:57