Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.html.tidy
Class TidyHTMLParser  view TidyHTMLParser download TidyHTMLParser.java

java.lang.Object
  extended bycom.port80.html.tidy.TidyHTMLParser
All Implemented Interfaces:
java.io.Serializable

public class TidyHTMLParser
extends java.lang.Object
implements java.io.Serializable

HTML parser and pretty printer. Adapted from Tidy v1.11 to use Java Reader/Writer instead of custom InputStream/OutputStream which make it easier to parse String input and return result in StringWriter.


Field Summary
private  TidyConfiguration configuration
           
private static int ERROR_INVALID_FILENAME
           
private  org.eclipse.ui.editors.text.TextEditor fEditor
           
private  org.eclipse.jface.text.source.ISourceViewer fViewer
           
private  java.lang.String inputStreamName
           
private static java.lang.String NAME
           
private  int parseErrors
           
private  int parseWarnings
           
(package private) static long serialVersionUID
           
 
Constructor Summary
TidyHTMLParser(TidyConfiguration cf)
           
 
Method Summary
static org.w3c.dom.Document createEmptyDocument()
          Creates an empty DOM Document.
 TidyConfiguration getConfiguration()
           
 int getParseErrors()
          ParseErrors - the number of errors that occurred in the most recent parse operation
 int getParseWarnings()
          ParseWarnings - the number of warnings that occurred in the most recent parse operation
private  void init(TidyConfiguration cf)
          First time initialization which should precede reading the command line.
static void main(java.lang.String[] argv)
          Command line interface to parser and pretty printer.
 Node parse(java.io.Reader in, java.io.PrintWriter out)
          Parse a complete HTML document.
 Node parse(java.io.Reader in, java.lang.String inputname, java.io.PrintWriter out)
           
 Node parse(java.lang.String file, java.io.PrintWriter out)
           
 org.w3c.dom.Document parseDOM(java.io.Reader in, java.io.PrintWriter out)
          Parses InputStream in and returns a DOM Document node.
 void pprint(org.w3c.dom.Document doc, java.io.PrintWriter out)
          Pretty-prints a DOM Document.
 void setCompactFormat(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

ERROR_INVALID_FILENAME

private static final int ERROR_INVALID_FILENAME
See Also:
Constant Field Values

fEditor

private org.eclipse.ui.editors.text.TextEditor fEditor

fViewer

private org.eclipse.jface.text.source.ISourceViewer fViewer

configuration

private TidyConfiguration configuration

inputStreamName

private java.lang.String inputStreamName

parseErrors

private int parseErrors

parseWarnings

private int parseWarnings
Constructor Detail

TidyHTMLParser

public TidyHTMLParser(TidyConfiguration cf)
Method Detail

getConfiguration

public TidyConfiguration getConfiguration()

getParseErrors

public int getParseErrors()
ParseErrors - the number of errors that occurred in the most recent parse operation


getParseWarnings

public int getParseWarnings()
ParseWarnings - the number of warnings that occurred in the most recent parse operation


setCompactFormat

public void setCompactFormat(boolean b)

init

private void init(TidyConfiguration cf)
First time initialization which should precede reading the command line.


parse

public Node parse(java.lang.String file,
                  java.io.PrintWriter out)
           throws java.io.FileNotFoundException,
                  java.io.IOException

parse

public Node parse(java.io.Reader in,
                  java.lang.String inputname,
                  java.io.PrintWriter out)
           throws java.io.IOException

parse

public Node parse(java.io.Reader in,
                  java.io.PrintWriter out)
           throws java.io.IOException
Parse a complete HTML document. Tags are inferred if needed.


parseDOM

public org.w3c.dom.Document parseDOM(java.io.Reader in,
                                     java.io.PrintWriter out)
                              throws java.io.IOException
Parses InputStream in and returns a DOM Document node. If out is non-null, pretty prints to OutputStream out.


pprint

public void pprint(org.w3c.dom.Document doc,
                   java.io.PrintWriter out)
Pretty-prints a DOM Document.


createEmptyDocument

public static org.w3c.dom.Document createEmptyDocument()
Creates an empty DOM Document.


main

public static void main(java.lang.String[] argv)
Command line interface to parser and pretty printer.