com.gargoylesoftware.htmlunit.html
Class HTMLParser

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.HTMLParser

public final class HTMLParser
extends Object

SAX parser implementation that uses the NekoHTML HTMLConfiguration to parse HTML into a HtmlUnit-specific DOM (HU-DOM) tree.

Version:
$Revision: 5908 $
Author:
Christian Sell, David K. Taylor, Chris Erskine, Ahmed Ashour, Marc Guillemot, Ethan Glasser-Camp, Sudhan Moghe

Field Summary
static String XHTML_NAMESPACE
          XHTML namespace.
 
Method Summary
static IElementFactory getFactory(String tagName)
           
static void parseFragment(DomNode parent, String source)
          Parses the HTML content from the given string into an object tree representation.
static HtmlPage parseHtml(WebResponse webResponse, WebWindow webWindow)
          Parses the HTML content from the specified WebResponse into an object tree representation.
static XHtmlPage parseXHtml(WebResponse webResponse, WebWindow webWindow)
          Parses the XHTML content from the specified WebResponse into an object tree representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XHTML_NAMESPACE

public static final String XHTML_NAMESPACE
XHTML namespace.

See Also:
Constant Field Values
Method Detail

getFactory

public static IElementFactory getFactory(String tagName)
Parameters:
tagName - an HTML element tag name
Returns:
a factory for creating HtmlElements representing the given tag

parseFragment

public static void parseFragment(DomNode parent,
                                 String source)
                          throws SAXException,
                                 IOException
Parses the HTML content from the given string into an object tree representation.

Parameters:
parent - the parent for the new nodes
source - the (X)HTML to be parsed
Throws:
SAXException - if a SAX error occurs
IOException - if an IO error occurs

parseHtml

public static HtmlPage parseHtml(WebResponse webResponse,
                                 WebWindow webWindow)
                          throws IOException
Parses the HTML content from the specified WebResponse into an object tree representation.

Parameters:
webResponse - the response data
webWindow - the web window into which the page is to be loaded
Returns:
the page object which is the root of the DOM tree
Throws:
IOException - if there is an IO error

parseXHtml

public static XHtmlPage parseXHtml(WebResponse webResponse,
                                   WebWindow webWindow)
                            throws IOException
Parses the XHTML content from the specified WebResponse into an object tree representation.

Parameters:
webResponse - the response data
webWindow - the web window into which the page is to be loaded
Returns:
the page object which is the root of the DOM tree
Throws:
IOException - if there is an IO error


Copyright © 2002-2010 Gargoyle Software Inc.. All Rights Reserved.