/**
*
* 实现 org.w3c.dom.Document到jdom的转换
* @param doc
* @return
* @throws Exception
*/
public static Document convertToJDOM(org.w3c.dom.Document doc) throws Exception {
if (doc == null) {
return (null);
}
DOMBuilder builder = new DOMBuilder();
Document jdomDoc = builder.build(doc);
return jdomDoc;
}
/**
*
* 实现 jdom到org.w3c.dom.Document的转换
* @param doc
* @return
* @throws Exception
*/
public static org.w3c.dom.Document convertToDOM(Document jdomDoc) throws JDOMException {
DOMOutputter outputter = new DOMOutputter();
return outputter.output(jdomDoc);
}
本文介绍了一种实现org.w3c.dom.Document与jdom之间的相互转换的方法。提供了将org.w3c.dom.Document转换为jdom以及从jdom转换回org.w3c.dom.Document的具体实现。
877

被折叠的 条评论
为什么被折叠?



