1 7 8 package sample; 9 10 import org.cyberneko.html.parsers.DOMParser; 11 import org.w3c.dom.Document ; 12 import org.w3c.dom.Node ; 13 14 23 public class TestHTMLDOM { 24 25 29 30 public static void main(String [] argv) throws Exception { 31 DOMParser parser = new DOMParser(); 32 for (int i = 0; i < argv.length; i++) { 33 parser.parse(argv[i]); 34 print(parser.getDocument(), ""); 35 } 36 } 38 42 43 public static void print(Node node, String indent) { 44 System.out.println(indent+node.getClass().getName()); 45 Node child = node.getFirstChild(); 46 while (child != null) { 47 print(child, indent+" "); 48 child = child.getNextSibling(); 49 } 50 } 52 } | Popular Tags |