outerHtml(_:)
Node.swift:736func outerHtml(_ accum: StringBuilder) throws
func outerHtml(_ accum: StringBuilder) throws
import SwiftSoup
class Node
class StringBuilder
Supports creation of a String from pieces Based on https://gist.github.com/kristopherjohnson/1fc55e811d944a430289
init()
Default constructor. Doesn’t setup base uri, children, or attributes; use with caution.
init(_ baseUri: [UInt8])
init(_ baseUri: [UInt8], _ attributes: Attributes)
Create a new Node.
var debugDescription: String { get }
var description: String { get }
var siblingIndex: Int { get }
Get the list index of this node in its node sibling list. I.e. if this is the first node sibling, returns 0.
static func == (lhs: Node, rhs: Node) -> Bool
func absUrl(_ attributeKey: String) throws -> String
Get an absolute URL from a URL attribute that may be relative (i.e. an <a href>
or <img src>
).
func absUrl<T>(_ attributeKey: T) throws -> [UInt8] where T : Collection, T.Element == UInt8
func addChildren(_ children: Node...) throws
func addChildren(_ children: [Node]) throws
func addChildren(_ index: Int, _ children: Node...) throws
func addChildren(_ index: Int, _ children: [Node]) throws
func addSiblingHtml(index: Int, _ html: String) throws
@discardableResult func after(_ node: Node) throws -> Node
Insert the specified node into the DOM after this node (i.e. as a following sibling).
@discardableResult func after(_ html: String) throws -> Node
Insert the specified HTML into the DOM after this node (i.e. as a following sibling).
@discardableResult func after(html: String) throws -> Node
Insert the specified HTML into the DOM after this node (i.e. as a following sibling).
@discardableResult func after(node: Node) throws -> Node
Insert the specified node into the DOM after this node (i.e. as a following sibling).
func attr(_ attributeKey: String) throws -> String
func attr(_ attributeKey: [UInt8]) throws -> [UInt8]
Get an attribute’s value by its key. Case insensitive
@discardableResult func attr(_ attributeKey: String, _ attributeValue: String) throws -> Node
@discardableResult func attr(_ attributeKey: [UInt8], _ attributeValue: [UInt8]) throws -> Node
Set an attribute (key=value). If the attribute already exists, it is replaced.
@discardableResult func before(_ node: Node) throws -> Node
Insert the specified node into the DOM before this node (i.e. as a preceding sibling).
@discardableResult func before(_ html: String) throws -> Node
Insert the specified HTML into the DOM before this node (i.e. as a preceding sibling).
@discardableResult func before(_ html: [UInt8]) throws -> Node
Insert the specified HTML into the DOM before this node (i.e. as a preceding sibling).
func childNode(_ index: Int) -> Node
Get a child node by its 0-based index.
func childNodeSize() -> Int
Get the number of child nodes that this node holds.
func childNodesCopy() -> Array<Node>
Returns a deep copy of this node’s children. Changes made to these nodes will not be reflected in the original nodes
func copy(clone: Node) -> Node
func copy(clone: Node, parent: Node?) -> Node
func copy(parent: Node?) -> Node
func copy(with zone: NSZone? = nil) -> Any
Create a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings or parent node. As a stand-alone object, any changes made to the clone or any of its children will not impact the original node.
func equals(_ o: Node) -> Bool
Check if this node is the same instance of another (object identity test).
func getAttributes() -> Attributes?
Get all of the element’s attributes.
func getBaseUri() -> String
Get the base URI of this node.
func getBaseUriUTF8() -> [UInt8]
func getChildNodes() -> Array<Node>
Get this node’s children. Presented as an unmodifiable list: new children can not be added, but the child nodes themselves can be manipulated.
func hasAttr(_ attributeKey: String) -> Bool
Test if this element has an attribute. Case insensitive
func hasAttr(_ attributeKey: [UInt8]) -> Bool
Test if this element has an attribute. Case insensitive
func hasChildNodes() -> Bool
func hasNextSibling() -> Bool
func hasSameValue(_ o: Node) throws -> Bool
Check if this node is has the same content as another node. A node is considered the same if its name, attributes and content match the other node; particularly its position in the tree does not influence its similarity.
func hash(into hasher: inout Hasher)
The hash value.
func html(_ appendable: StringBuilder) throws -> StringBuilder
Write this node and its children to the given {@link Appendable}.
func indent(_ accum: StringBuilder, _ depth: Int, _ out: OutputSettings)
func nextSibling() -> Node?
Get this node’s next sibling.
func nodeName() -> String
Get the node name of this node. Use for debugging purposes and not logic switching (for that, use instanceof).
func nodeNameUTF8() -> [UInt8]
func outerHtml() throws -> String
Get the outer HTML of this node.
func ownerDocument() -> Document?
Gets the Document associated with this Node.
func parent() -> Node?
Gets this node’s parent node.
func previousSibling() -> Node?
Get this node’s previous sibling.
func remove() throws
Remove (delete) this node from the DOM tree. If this node has children, they are also removed.
@discardableResult func removeAttr(_ attributeKey: String) throws -> Node
@discardableResult func removeAttr(_ attributeKey: [UInt8]) throws -> Node
Remove an attribute from this element.
func removeChild(_ out: Node) throws
func reparentChild(_ child: Node) throws
func replaceChild(_ out: Node, _ input: Node) throws
func replaceWith(_ input: Node) throws
Replace this node in the DOM with the supplied node.
func setBaseUri(_ baseUri: String) throws
Update the base URI of this node and all of its descendants.
func setBaseUri(_ baseUri: [UInt8]) throws
func setParentNode(_ parentNode: Node) throws
func setSiblingIndex(_ siblingIndex: Int)
func siblingNodes() -> Array<Node>
Retrieves this node’s sibling nodes. Similar to {@link #childNodes() node.parent.childNodes()}, but does not include this node (a node is not a sibling of itself).
@discardableResult func traverse(_ nodeVisitor: NodeVisitor) throws -> Node
Perform a depth-first traversal through this node and its descendants.
@discardableResult func unwrap() throws -> Node?
Removes this node from the DOM, and moves its children up into the node’s parent. This has the effect of dropping the node but keeping its children.
@discardableResult func wrap(_ html: String) throws -> Node?
Wrap the supplied HTML around this node.