日期:2014-05-20  浏览次数:20740 次

应用jtidy的问题,高手请进
请问应用jtidy为什么一直出错?程序如下:
import   java.net.URL;  
import   java.io.*;  
import   org.w3c.tidy.Tidy;  

public   class   TestHTML2XML   {  
private   String   url;  
private   String   outFileName;  
private   String   errOutFileName;  

public   TestHTML2XML(String   url,   String   outFileName,   String   errOutFileName)   {  
this.url   =   url;  
this.outFileName   =   outFileName;  
this.errOutFileName   =   errOutFileName;  
}  

public   void   convert()   {  
URL   u;  
BufferedInputStream   in;  
FileOutputStream   out;  

Tidy   tidy   =   new   Tidy();  

//Tell   Tidy   to   convert   HTML   to   XML  
tidy.setXmlOut(true);  

try   {  
//Set   file   for   error   messages  
tidy.setErrout(new   PrintWriter(new   FileWriter(errOutFileName),   true));  
u   =   new   URL(url);  

//Create   input   and   output   streams  
in   =   new   BufferedInputStream(u.openStream());  
out   =   new   FileOutputStream(outFileName);  

//Convert   files  
tidy.parse(in,   out);  

//Clean   up  
in.close();  
out.close();  

}   catch   (IOException   e)   {  
System.out.println(this.toString()   +   e.toString());  
}  
}  

public   static   void   main(String[]   args)   {  
/*  
*   Parameters   are:  
*   URL   of   HTML   file  
*   Filename   of   output   file  
*   Filename   of   error   file  
*/  
TestHTML2XML   t   =   new   TestHTML2XML(args[0],   args[1],   args[2]);  
t.convert();  
}  
}  
编译没有问题,但是一运行就报错,
E:\> java   TestHTML2XML   E:\testhtml\test.html   E:\testhtml   E:\testhtml
TestHTML2XML@b6ece5java.io.FileNotFoundException:   E:\testhtml   (拒绝访问。)
请问高手如何解决?

------解决方案--------------------
E:\> java TestHTML2XML E:\\testhtml\\test.html E:\\testhtml E:\\testhtml这样试试