- From: Peter Johns <johnspeter@hotmail.com>
- Date: Sat, 05 May 2001 17:59:59 -0400
- To: html-tidy@w3c.org
Hi,
I am new to using jTidy. I need to clean up a local HTML file saving the
result as an XML one.
Here is my code snippet, I don't see what I am doing wrong.
Do they have JTidy tutorials? Could you help me out with this one?
THanks
//------------- CODE ---------------
import org.w3c.tidy.Tidy;
import java.io.*;
class JTidy00{
private boolean xmlOut = true;
// __
public JTidy00(){}
// __
public void HTML2XML(String errOutFileName, String azIFlNm, String
outFileName){
BufferedInputStream BIS = null;
FileOutputStream FOS = null;
Tidy tidy = new Tidy();
tidy.setXmlOut(xmlOut);
try{
tidy.setErrout(new PrintWriter(new FileWriter(errOutFileName), true));
BIS = new BufferedInputStream(new FileInputStream(azIFlNm));
FOS = new FileOutputStream(outFileName);
// tidy.parse(BIS, FOS);
tidy.?(BIS, FOS);
} catch (IOException IOXcptn) { IOXcptn.printStackTrace(); }
finally{
try{
if(BIS != null)BIS.close();
if(FOS != null)FOS.close();
} catch (IOException IOXcptn){ IOXcptn.printStackTrace(); }
}
}
}
// __
public class TestJTidy00{
public static void main( String[] args ){
String errOutFileName, azIFlNm, outFileName;
errOutFileName="PrntOut.txt";
azIFlNm = "htmlfile.html";
outFileName = "xmlfile.xml";
JTidy00 JT = new JTidy00();
JT.HTML2XML(errOutFileName, azIFlNm, outFileName);
}
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
Received on Saturday, 5 May 2001 18:00:39 UTC