Text

public final class Text: TextNode

The Text class represents the textual content (termed character data in XML) of an Element. If there is no markup inside an element’s content, the text is contained in a single object implementing the Text protocol that is the only child of the element. If there is markup, it is parsed into a sequence of elements and Text nodes that form the array of children of the element.

  • The nodeType of a Text node is .text.

    Declaration

    Swift

    public static let nodeType: NodeType = .text
  • The nodeName of a Text node is #text.

    Declaration

    Swift

    public final let nodeName: String = "#text"
  • The attributes dictionary of a Text node is nil.

    Declaration

    Swift

    public final let attributes: [String : String]? = nil
  • The string contents of this text node.

    Declaration

    Swift

    public final var text: String
  • Creates a new Text node.

    Declaration

    Swift

    public init(text: String)

    Parameters

    text

    The string contents of this text node.

  • A text node calls visit(self) on the visitor.

    Declaration

    Swift

    public func accept(_ visitor: Visitor)