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 public class HtmlParse {
24
25
26
27
28 public static void main (String args[]) throws IOException {
29 InputStream r;
30 HtmlDocument document;
31
32 for (int i=0; i < args.length; i++) {
33 r = new FileInputStream(args[i]);
34
35 try {
36 document = new HtmlParser(r).HtmlDocument();
37 document.accept(new HtmlScrubber(HtmlScrubber.DEFAULT_OPTIONS
38 | HtmlScrubber.TRIM_SPACES));
39 document.accept(new HtmlDumper(System.out));
40 }
41 catch (Exception e) {
42 e.printStackTrace();
43 }
44 finally {
45 r.close();
46 }
47 }
48
49 }
50 }