• 大小: 11.11MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-17
  • 语言: Java
  • 标签: dom4j  

资源简介

dom4j是一款非常好用的解析xml的工具类 dom4j需要的jar包主要有两个,都放在根目录下了 另外一个文件夹是dom4j的官方详细资料

资源截图

代码片段和文件信息


import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.XPath;
import org.dom4j.io.DOMWriter;
import org.dom4j.io.DocumentResult;
import org.dom4j.io.DocumentSource;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.xmlWriter;

public class PerfDOM4J {

    public static void main(String args[]) {
        Document doc;

        try {
            int numrec = 1;

            numrec = 10000;
            System.out.println(“\n10000 Elements ------------------“);
            doc = PerfDOM4J.createDocument(numrec 20 1);
            PerfDOM4J.createW3CDOM(doc);
            PerfDOM4J.write(doc “dom4j_“ + numrec + “.xml“);
            // PerfDOM4J.parse(numrec1);
            // PerfDOM4J.transform(doc“item.xslt“1);
            PerfDOM4J.xpath(doc “/*/*/Attr1x1“ 1);
            PerfDOM4J.xpath(doc “/*/*/Attr1x5000“ 1);
            PerfDOM4J.xpath(doc “/*/*/Attr1x9999“ 1);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x1“ 1);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x5000“ 1);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x9999“ 1);
            PerfDOM4J.xpathNodes(doc “/*/Item“ 3);

            numrec = 1000;
            System.out.println(“\n1000 Elements -------------------“);
            doc = PerfDOM4J.createDocument(numrec 20 1);
            PerfDOM4J.createW3CDOM(doc);
            PerfDOM4J.write(doc “dom4j_“ + numrec + “.xml“);
            PerfDOM4J.parse(numrec 3);
            PerfDOM4J.transform(doc “item.xslt“ 3);
            PerfDOM4J.xpath(doc “/*/*/Attr1x1“ 3);
            PerfDOM4J.xpath(doc “/*/*/Attr1x500“ 3);
            PerfDOM4J.xpath(doc “/*/*/Attr1x999“ 3);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x1“ 3);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x500“ 3);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x999“ 3);
            PerfDOM4J.xpathNodes(doc “/*/Item“ 10);

            numrec = 100;
            System.out.println(“\n100 Elements --------------------“);
            doc = PerfDOM4J.createDocument(numrec 20 10);
            PerfDOM4J.createW3CDOM(doc);
            PerfDOM4J.write(doc “dom4j_“ + numrec + “.xml“);
            PerfDOM4J.parse(numrec 10);
            PerfDOM4J.transform(doc “item.xslt“ 10);
            PerfDOM4J.xpath(doc “/*/*/Attr1x1“ 10);
            PerfDOM4J.xpath(doc “/*/*/Attr1x50“ 10);
            PerfDOM4J.xpath(doc “/*/*/Attr1x99“ 10);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x1“ 10);
            PerfDOM4J.xpathNodes(doc “/*/*/Attr1x50“ 10);
            PerfDOM4J.xpathNodes(doc “/*

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      27517  2005-05-16 14:28  dom4j\dom4j-1.6.1\build.xml

     文件      19814  2005-05-16 14:26  dom4j\dom4j-1.6.1\docs\apidocs\allclasses-frame.html

     文件      16714  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\allclasses-noframe.html

     文件      19442  2005-05-16 14:26  dom4j\dom4j-1.6.1\docs\apidocs\constant-values.html

     文件      10893  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\deprecated-list.html

     文件       9199  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\help-doc.html

     文件     777476  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\index-all.html

     文件        983  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\index.html

     文件      24100  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\Attribute.html

     文件      31302  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\BeanAttribute.html

     文件      32011  2005-05-16 14:26  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\BeanAttributeList.html

     文件      25000  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\BeanDocumentFactory.html

     文件      59964  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\BeanElement.html

     文件      20826  2005-05-16 14:26  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\BeanmetaData.html

     文件       8350  2005-05-16 14:26  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\class-use\BeanAttribute.html

     文件       9232  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\class-use\BeanAttributeList.html

     文件       5877  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\class-use\BeanDocumentFactory.html

     文件      10705  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\class-use\BeanElement.html

     文件       8826  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\class-use\BeanmetaData.html

     文件       1429  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\package-frame.html

     文件       8035  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\package-summary.html

     文件       9251  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\package-tree.html

     文件       7796  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\bean\package-use.html

     文件      45436  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\Branch.html

     文件      13011  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\CDATA.html

     文件      15122  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\CharacterData.html

     文件      52467  2005-05-16 14:28  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\class-use\Attribute.html

     文件      32460  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\class-use\Branch.html

     文件      22738  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\class-use\CDATA.html

     文件      26106  2005-05-16 14:27  dom4j\dom4j-1.6.1\docs\apidocs\org\dom4j\class-use\CharacterData.html

............此处省略1632个文件信息

评论

共有 条评论