## org.apache.lucene.ant
Class HtmlDocument

    java.lang.Object
      org.apache.lucene.ant.HtmlDocument

    public class HtmlDocument

extends java.lang.Object

The `HtmlDocument` class creates a Lucene `Document` from an HTML document.

It does this by using JTidy package. It can take input input from `File` or `InputStream`.

Constructor Summary
`HtmlDocument(java.io.File file)` Constructs an `HtmlDocument` from a `File`.
`HtmlDocument(java.io.File file, java.lang.String tidyConfigFile)` Constructs an `HtmlDocument` from a `File`.
`HtmlDocument(java.io.InputStream is)` Constructs an `HtmlDocument` from an `InputStream`.

Method Summary
`static Document` `Document(java.io.File file)` Creates a Lucene `Document` from a `File`.
`static Document` `Document(java.io.File file, java.lang.String tidyConfigFile)` Creates a Lucene `Document` from a `File`.
`java.lang.String` `getBody()` Gets the bodyText attribute of the `HtmlDocument` object.
`static Document` `getDocument(java.io.InputStream is)` Creates a Lucene `Document` from an `InputStream`.
`java.lang.String` `getTitle()` Gets the title attribute of the `HtmlDocument` object.
`static void` `main(java.lang.String[] args)` Runs `HtmlDocument` on the files specified on the command line.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HtmlDocument

    public HtmlDocument(java.io.File file)
                 throws java.io.IOException

  Constructs an `HtmlDocument` from a `File`.

  Parameters:
    `file` - the `File` containing the HTML to parse
  Throws:
    `java.io.IOException` - if an I/O exception occurs

### HtmlDocument

    public HtmlDocument(java.io.InputStream is)

  Constructs an `HtmlDocument` from an `InputStream`.

  Parameters:
    `is` - the `InputStream` containing the HTML

### HtmlDocument

    public HtmlDocument(java.io.File file,
                        java.lang.String tidyConfigFile)
                 throws java.io.IOException

  Constructs an `HtmlDocument` from a `File`.

  Parameters:
    `file` - the `File` containing the HTML to parse
    `tidyConfigFile` - the `String` containing the full path to the Tidy config file
  Throws:
    `java.io.IOException` - if an I/O exception occurs

Method Detail

### Document

    public static Document Document(java.io.File file,
                                    java.lang.String tidyConfigFile)
                             throws java.io.IOException

  Creates a Lucene `Document` from a `File`.

  Parameters:
    `file` -
    `tidyConfigFile` - the full path to the Tidy config file
  Throws:
    `java.io.IOException`

### getDocument

    public static Document getDocument(java.io.InputStream is)

  Creates a Lucene `Document` from an `InputStream`.

  Parameters:
    `is` -

### Document

    public static Document Document(java.io.File file)
                             throws java.io.IOException

  Creates a Lucene `Document` from a `File`.

  Parameters:
    `file` -
  Throws:
    `java.io.IOException`

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Runs `HtmlDocument` on the files specified on the command line.

  Parameters:
    `args` - Command line arguments
  Throws:
    `java.lang.Exception` - Description of Exception

### getTitle

    public java.lang.String getTitle()

  Gets the title attribute of the `HtmlDocument` object.

  Returns:
    the title value

### getBody

    public java.lang.String getBody()

  Gets the bodyText attribute of the `HtmlDocument` object.

  Returns:
    the bodyText value

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.