HTMLDocument
public final class HTMLDocument: HTMLDocumentType
Instances of this class represent HTML documents.
-
Creates an
HTMLDocument
instance from a string.Declaration
Swift
public init?(html: String, url: String? = nil, encoding: String.Encoding, options: HTMLParserOptions = .default)
Parameters
html
A string to create the document from.
url
The base URL to use for the document. Default is
nil
.encoding
Encoding to use for parsing HTML.
options
Options to use for parsing HTML. Default value is
HTMLParserOptions.default
. -
Creates an
HTMLDocument
instance from binary data.Declaration
Swift
public convenience init?(html: Data, url: String? = nil, encoding: String.Encoding, options: HTMLParserOptions = .default)
Parameters
html
Data to create the document from.
url
The base URL to use for the document. Default is
nil
.encoding
Encoding to use for parsing HTML.
options
Options to use for parsing HTML. Default value is
HTMLParserOptions.default
. -
Creates an
HTMLDocument
instance from binary data.Declaration
Swift
public convenience init?(url: URL, encoding: String.Encoding, options: HTMLParserOptions = .default)
Parameters
url
URL to load the document from.
encoding
Encoding to use for parsing HTML.
options
Options to use for parsing HTML. Default value is
HTMLParserOptions.default
.