Package 

Object Documents

    • Method Detail

      • parse

         final FeaturedDocument parse(String html, String baseUri)

        Parse HTML into a FeaturedDocument. The parser will make a sensible, balanced document tree out of any HTML.

        Parameters:
        html - HTML to parse
        baseUri - The URL where the HTML was retrieved from.
      • parse

         final FeaturedDocument parse(String html, String baseUri, Parser parser)

        Parse HTML into a FeaturedDocument, using the provided Parser. You can provide an alternate parser, such as a simple XML (non-HTML) parser.

        Parameters:
        html - HTML to parse
        baseUri - The URL where the HTML was retrieved from.
        parser - alternate parser to use.
      • parse

         final FeaturedDocument parse(String html)

        Parse HTML into a FeaturedDocument. As no base PAGE is specified, absolute URL detection relies on the HTML including a <base href> tag.

        Parameters:
        html - HTML to parse
      • parse

         final FeaturedDocument parse(File file, String charsetName, String baseUri)

        Parse the contents of a file as HTML.

        Parameters:
        file - file to load HTML from
        charsetName - (optional) character set of file contents.
        baseUri - The URL where the HTML was retrieved from, to resolve relative links against.
      • parse

         final FeaturedDocument parse(File file, String charsetName)

        Parse the contents of a file as HTML. The location of the file is used as the base PAGE to qualify relative URLs.

        Parameters:
        file - file to load HTML from
        charsetName - (optional) character set of file contents.
      • parse

         final FeaturedDocument parse(InputStream istream, String charsetName, String baseUri)

        Read an input stream, and parse it to a FeaturedDocument.

        Parameters:
        istream - input stream to read.
        charsetName - (optional) character set of file contents.
        baseUri - The URL where the HTML was retrieved from, to resolve relative links against.
      • parse

         final FeaturedDocument parse(InputStream istream, String charsetName, String baseUri, Parser parser)

        Read an input stream, and parse it to a FeaturedDocument. You can provide an alternate parser, such as a simple XML (non-HTML) parser.

        Parameters:
        istream - input stream to read.
        charsetName - (optional) character set of file contents.
        baseUri - The URL where the HTML was retrieved from, to resolve relative links against.
        parser - alternate parser to use.
      • parse

         final FeaturedDocument parse(URL url, Long timeoutMillis)

        Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use .connect instead.

        The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to UTF-8.

        Parameters:
        url - URL to fetch (with a GET).
        timeoutMillis - Connection and read timeout, in milliseconds.
      • connect

         final Connection connect(String url)

        Creates a new Connection to a URL. Use to fetch and parse a HTML page.

        Use examples:

        • Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "dom").get();

        • Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();

        Parameters:
        url - URL to connect to.
      • parseBodyFragment

         final FeaturedDocument parseBodyFragment(String bodyHtml, String baseUri)

        Parse a fragment of HTML, with the assumption that it forms the body of the HTML.

        Parameters:
        bodyHtml - body HTML fragment
        baseUri - URL to resolve relative URLs against.
      • parseBodyFragment

         final FeaturedDocument parseBodyFragment(String bodyHtml)

        Parse a fragment of HTML, with the assumption that it forms the body of the HTML.

        Parameters:
        bodyHtml - body HTML fragment