| 1 | |
package com.quiotix.html.example; |
| 2 | |
|
| 3 | |
import java.io.FileInputStream; |
| 4 | |
import java.io.IOException; |
| 5 | |
import java.io.InputStream; |
| 6 | |
|
| 7 | |
import com.quiotix.html.parser.HtmlDocument; |
| 8 | |
import com.quiotix.html.parser.HtmlDumper; |
| 9 | |
import com.quiotix.html.parser.HtmlParser; |
| 10 | |
import com.quiotix.html.parser.HtmlScrubber; |
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | 0 | public class HtmlParse { |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
public static void main (String args[]) throws IOException { |
| 29 | |
InputStream r; |
| 30 | |
HtmlDocument document; |
| 31 | |
|
| 32 | 0 | for (int i=0; i < args.length; i++) { |
| 33 | 0 | r = new FileInputStream(args[i]); |
| 34 | |
|
| 35 | |
try { |
| 36 | 0 | document = new HtmlParser(r).HtmlDocument(); |
| 37 | 0 | document.accept(new HtmlScrubber(HtmlScrubber.DEFAULT_OPTIONS |
| 38 | |
| HtmlScrubber.TRIM_SPACES)); |
| 39 | 0 | document.accept(new HtmlDumper(System.out)); |
| 40 | |
} |
| 41 | 0 | catch (Exception e) { |
| 42 | 0 | e.printStackTrace(); |
| 43 | |
} |
| 44 | |
finally { |
| 45 | 0 | r.close(); |
| 46 | 0 | } |
| 47 | |
} |
| 48 | |
|
| 49 | 0 | } |
| 50 | |
} |