Coverage Report - com.quiotix.html.parser.HtmlDebugDumper
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlDebugDumper
0%
0/27
N/A
1
 
 1  
 /*
 2  
  * HtmlDumper.java -- Dumps an HTML document tree. 
 3  
  * Copyright (C) 1999 Quiotix Corporation.  
 4  
  *
 5  
  * This program is free software; you can redistribute it and/or modify
 6  
  * it under the terms of the GNU General Public License, version 2, as 
 7  
  * published by the Free Software Foundation.  
 8  
  *
 9  
  * This program is distributed in the hope that it will be useful,
 10  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
  * GNU General Public License (http://www.gnu.org/copyleft/gpl.txt)
 13  
  * for more details.
 14  
  */
 15  
 
 16  
 package com.quiotix.html.parser;
 17  
 
 18  
 import java.io.OutputStream;
 19  
 import java.io.PrintWriter;
 20  
 
 21  
 /**
 22  
  * Simple HtmlVisitor which dumps out the document to the specified
 23  
  * output stream.
 24  
  *
 25  
  * @author Brian Goetz, Quiotix
 26  
  */
 27  
 
 28  
 public class HtmlDebugDumper extends HtmlVisitor {
 29  
     protected PrintWriter out;
 30  
 
 31  
     /** Constructor. */
 32  0
     public HtmlDebugDumper(OutputStream os) {
 33  0
         out = new PrintWriter(os);
 34  0
     }
 35  
 
 36  
     public void finish() {
 37  0
         out.flush();
 38  0
     }
 39  
 
 40  
     public void visit(HtmlDocument.Tag t) {
 41  0
         out.print("Tag(" + t + ")");
 42  0
     }
 43  
 
 44  
     public void visit(HtmlDocument.EndTag t) {
 45  0
         out.print("Tag(" + t + ")");
 46  0
     }
 47  
 
 48  
     public void visit(HtmlDocument.Comment c) {
 49  0
         out.print("Comment(" + c + ")");
 50  0
     }
 51  
 
 52  
     public void visit(HtmlDocument.Text t) {
 53  0
         out.print(t);
 54  0
     }
 55  
 
 56  
     public void visit(HtmlDocument.Newline n) {
 57  0
         out.println("-NL-");
 58  0
     }
 59  
 
 60  
     public void visit(HtmlDocument.Annotation a) {
 61  0
         out.print(a);
 62  0
     }
 63  
 
 64  
     public void visit(HtmlDocument.TagBlock bl) {
 65  0
         out.print("<BLOCK>");
 66  0
         visit(bl.startTag);
 67  0
         visit(bl.body);
 68  0
         visit(bl.endTag);
 69  0
         out.print("</BLOCK>");
 70  0
     }
 71  
 
 72  
     /**
 73  
      * Runnable.
 74  
      */
 75  
     public static void main(String[] args) throws ParseException {
 76  0
         HtmlParser parser = new HtmlParser(System.in);
 77  0
         HtmlDocument doc = parser.HtmlDocument();
 78  0
         doc.accept(new HtmlDebugDumper(System.out));
 79  0
     }
 80  
 }
 81  
 
 82  
 
 83  
 
 84  
 
 85  
 
 86