关键字: java xml API翻了好久才找到DOMWriter这个东东,赶紧记下来,别忘了,呵呵 代码 public static org.w3c.dom.Document toW3CDocument(org.dom4j.Document d4doc) { org.dom4j.io.DOMWriter d4Writer = new org.dom4j.io.DOMWriter(); try { return d4Writer.write(d4doc); } catch(DocumentException e) { logger.warn("can't cast dom4jDocument to W3CDocument", e); return null; } }