head
Accessor to the document’s {@code head} element.
func head() -> Element?
<return>
@code head
Accessor to the document’s {@code head} element.
func head() -> Element?
<return>
@code head
import SwiftSoup
class Document
class Element
init(_ baseUri: String)
init(_ baseUri: [UInt8])
Create a new, empty Document.
static func createShell(_ baseUri: String) -> Document
Create a valid, empty shell of a document, suitable for adding more elements to.
static func createShell(_ baseUri: [UInt8]) -> Document
func body() -> Element?
Accessor to the document’s {@code body} element.
func charset() -> String.Encoding
Returns the charset used in this document. This method is equivalent to {@link OutputSettings#charset()}.
func charset(_ charset: String.Encoding) throws
Sets the charset used in this document. This method is equivalent to {@link OutputSettings#charset(java.nio.charset.Charset) OutputSettings.charset(Charset)} but in addition it updates the charset / encoding element within the document.
override func copy(clone: Node, parent: Node?) -> Node
override func copy(parent: Node?) -> Node
override func copy(with zone: NSZone? = nil) -> Any
func createElement(_ tagName: String) throws -> Element
Create a new Element, with this document’s base uri. Does not make the new element a child of this document.
func location() -> String
Get the URL this Document was parsed from. If the starting URL is a redirect, this will return the final URL from which the document was served from.
override func nodeName() -> String
override func nodeNameUTF8() -> [UInt8]
@discardableResult func normalise() throws -> Document
Normalise the document. This happens after the parse phase so generally does not need to be called. Moves any text content that is not in the body element into the body.
override func outerHtml() throws -> String
func outputSettings() -> OutputSettings
Get the document’s current output settings.
@discardableResult func outputSettings(_ outputSettings: OutputSettings) -> Document
Set the document’s output settings.
func quirksMode() -> Document.QuirksMode
@discardableResult func quirksMode(_ quirksMode: Document.QuirksMode) -> Document
@discardableResult override func text(_ text: String) throws -> Element
Set the text of the {@code body} of this document. Any existing nodes within the body will be cleared.
func title() throws -> String
Get the string contents of the document’s {@code title} element.
func title(_ title: String) throws
Set the document’s {@code title} element. Updates the existing element, or adds {@code title} to {@code head} if not present
func updateMetaCharsetElement() -> Bool
Returns whether the element with charset information in this document is updated on changes through {@link #charset(java.nio.charset.Charset) Document.charset(Charset)} or not.
func updateMetaCharsetElement(_ update: Bool)
Sets whether the element with charset information in this document is updated on changes through {@link #charset(java.nio.charset.Charset) Document.charset(Charset)} or not.
enum QuirksMode