org.jsoup.parser
Class Parser

java.lang.Object
  extended by org.jsoup.parser.Parser

public class Parser
extends Object

Parses HTML into a Document. Generally best to use one of the more convenient parse methods in Jsoup.

Author:
Jonathan Hedley, [email protected]

Method Summary
static Document parse(String html, String baseUri)
          Parse HTML into a Document.
static Document parseBodyFragment(String bodyHtml, String baseUri)
          Parse a fragment of HTML into the body of a Document.
static Document parseBodyFragmentRelaxed(String bodyHtml, String baseUri)
          Parse a fragment of HTML into the body of a Document, with relaxed parsing enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static Document parse(String html,
                             String baseUri)
Parse HTML into a Document.

Parameters:
html - HTML to parse
baseUri - base URI of document (i.e. original fetch location), for resolving relative URLs.
Returns:
parsed Document

parseBodyFragment

public static Document parseBodyFragment(String bodyHtml,
                                         String baseUri)
Parse a fragment of HTML into the body of a Document.

Parameters:
bodyHtml - fragment of HTML
baseUri - base URI of document (i.e. original fetch location), for resolving relative URLs.
Returns:
Document, with empty head, and HTML parsed into body

parseBodyFragmentRelaxed

public static Document parseBodyFragmentRelaxed(String bodyHtml,
                                                String baseUri)
Parse a fragment of HTML into the body of a Document, with relaxed parsing enabled. Relaxed, in this context, means that implicit tags are not automatically created when missing.

Parameters:
bodyHtml - fragment of HTML
baseUri - base URI of document (i.e. original fetch location), for resolving relative URLs.
Returns:
Document, with empty head, and HTML parsed into body


Copyright © 2009-2010 Jonathan Hedley. All Rights Reserved.