Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java org.w3c.dom.Document和org.dom4j.Document之间的差异_Java_Domparser - Fatal编程技术网

Java org.w3c.dom.Document和org.dom4j.Document之间的差异

Java org.w3c.dom.Document和org.dom4j.Document之间的差异,java,domparser,Java,Domparser,为什么我们需要这两份文件 1)org.w3c.dom.Document 2)org.dom4j.Document 这两者有什么区别 public static org.dom4j.Document getDom4jDocument(Document w3cDocument) { //System.out.println("XMLUtility : Inside getDom4jDocument()"); org.dom4j.Document dom4jDo

为什么我们需要这两份文件

1)org.w3c.dom.Document 2)org.dom4j.Document

这两者有什么区别

public static org.dom4j.Document getDom4jDocument(Document w3cDocument)
    {
        //System.out.println("XMLUtility : Inside getDom4jDocument()");
        org.dom4j.Document dom4jDocument  = null;
        DOMReader xmlReader  = null;
        try{
            //System.out.println("Before conversion of w3cdoc to dom4jdoc");
            xmlReader = new DOMReader();            
            dom4jDocument = xmlReader.read(w3cDocument);
            //System.out.println("Conversion complete");
        }catch(Exception e){
            System.out.println("General Exception :- "+e.getMessage());
        }
        //System.out.println("XMLUtility : getDom4jDocument() Finished");
        return dom4jDocument;   
    } 

org.w3c.dom.Document
是JavaSE上的标准API,而
org.dom4j.Document
是针对dom4j的。它们之间不兼容


你不需要2,这取决于你的口味。有些人喜欢使用Dom4J,有些人坚持使用标准的JavaSEAPI。

org.w3c.dom.Document
是JavaSE上的标准API,而
org.Dom4J.Document
是用于Dom4J的。它们之间不兼容


你不需要2,这取决于你的口味。有些人更喜欢使用Dom4J,有些人坚持使用标准的JavaSEAPI。

在将org.w3c.dom.Document转换为org.Dom4J.Document时,我得到了StackOverflower错误。我编辑了这个转换的问题。@chetan,现在你问的是一个完全不同的问题。编辑这篇文章或者问一个新问题。我在将org.w3c.dom.Document转换为org.dom4j.Document时遇到StackOverflower错误。我编辑了这个转换的问题。@chetan,现在你问的是一个完全不同的问题。编辑这篇文章或者问一个新问题。