public LogAnalyser(String xmlpath) {
    try
        {
            File fl = new File(xmlpath);
            if(!fl.exists())
            {
                System.out.println("Not Find xml file:" + xmlpath);
                throw new java.io.FileNotFoundException("Not Find xml file:" + xmlpath);
            }
            System.out.println("Start reading");
            SAXReader reader = new SAXReader();
            Document document = reader.read(fl);
        }
        catch(java.io.FileNotFoundException e)
        {
            System.out.println("Not Find xml file:" + xmlpath);
        }
        catch(java.io.IOException e)
        {
          System.out.println("Not Find xml file:" + xmlpath + e.getMessage());
        }
        catch(Exception e)
        {
          e.printStackTrace();
        }  }

解决方案 »

  1.   

    还是不行,outofmemory ,真够烂的
      

  2.   

    JDOM是读进整棵树到内存的,所以如果xml文件过大,的确有可能造成out of memory
    错误,即使你只操作了一个getRootElement。采用SAX应该可以解决吧
      

  3.   

    为你的java 虚拟机设定参数。
    -Xms128m -Xmx512m 
    set  JVM memory allocation pool parameters
      

  4.   

    jdom 效力 很差最好不用用 sax2
      

  5.   

    上面的code是dom4j,也是不行,有sax2的例子吗?已经准备改用c去分析字串