src/services/HTMLTextConverter.java
//This method converts HTML Files into text documents.
This method converts HTML Files into text documents.
This method converts HTML Files into text documents .
public static void convertHtmlToText(String projectDir)
			throws IOException, FileNotFoundException, NullPointerException {
		System.out.println(">>Pre-processing HTML files...");
		org.jsoup.nodes.Document doc = null;
		BufferedWriter out = null;
		try {
			File dir = new File(projectDir+"\\src\\W3C Web Pages\\");
			File[] fileArray = dir.listFiles();
			for (File file : fileArray) {
				doc = Jsoup.parse(file, "UTF-8");
				String str = file.getName().substring(0, file.getName().lastIndexOf('.'));
				out = new BufferedWriter(
						new FileWriter(projectDir+"\\src\\ConvertedTextFiles\\"
								+ str  + ".txt"));
				out.write(fileCreator(file));
				out.close();
			}
		} catch (Exception e) {
			System.out.println(">>Exception on HTMLTextConverted.convertHtmlToText:"+e);
		}
	}
public static void convertHtmlToText ( String projectDir ) throws IOException , FileNotFoundException , NullPointerException { System . out . println ( ">>Pre-processing HTML files..." ) ; org . jsoup . nodes . Document doc = null ; BufferedWriter out = null ; try { File dir = new File ( projectDir + "\\src\\W3C Web Pages\\" ) ; File [ ] fileArray = dir . listFiles ( ) ; for ( File file : fileArray ) { doc = Jsoup . parse ( file , "UTF-8" ) ; String str = file . getName ( ) . substring ( 0 , file . getName ( ) . lastIndexOf ( '.' ) ) ; out = new BufferedWriter ( new FileWriter ( projectDir + "\\src\\ConvertedTextFiles\\" + str + ".txt" ) ) ; out . write ( fileCreator ( file ) ) ; out . close ( ) ; } } catch ( Exception e ) { System . out . println ( ">>Exception on HTMLTextConverted.convertHtmlToText:" + e ) ; } }
This method converts HTML Files into text documents.
This method converts HTML Files into text documents .
// TODO: handle exception