CDATASection

public final class CDATASection: TextNode

CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections can not be nested. The primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

The text property holds the text that is contained by the CDATA section. Note that this may contain characters that need to be escaped outside of CDATA sections.

  • The nodeType of a CDATASection is .cdataSection.

    Declaration

    Swift

    public static let nodeType: NodeType = .cdataSection
  • The nodeName of a CDATASection is #cdata-section.

    Declaration

    Swift

    public final let nodeName: String = "#cdata-section"
  • The attributes dictionary of a CDATASection is nil.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    public init(text: String)

    Parameters

    text

    The string contents of this CDATA secion.

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

    Declaration

    Swift

    public func accept(_ visitor: Visitor)