com.aspose.html.dom

Class Text

    • Constructor Detail

      • Text

        public Text(String data,
                    Document doc)

        Initializes a new instance of the Text class.

        Parameters:
        strData - The STR data.
        doc - The document.
    • Method Detail

      • splitText

        @DOMNameAttribute(name="splitText")
        public Text splitText(int offset)

        Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings.

        Parameters:
        offset - The offset.
        Returns:
        The Text.
      • isElementContentWhitespace

        @DOMNameAttribute(name="isElementContentWhitespace")
        public boolean isElementContentWhitespace()

        Returns whether this text node contains element content whitespace, often abusively called "ignorable whitespace".

        Value: true if this instance is element content whitespace; otherwise, false.
      • getWholeText

        @DOMNameAttribute(name="wholeText")
        public String getWholeText()

        Returns all text of Text nodes logically-adjacent text nodes to this node, concatenated in document order.

      • replaceWholeText

        @DOMNameAttribute(name="replaceWholeText")
        public Text replaceWholeText(String content)

        Replaces the text of the current node and all logically-adjacent text nodes with the specified text. All logically-adjacent text nodes are removed including the current node unless it was the recipient of the replacement text.

        Parameters:
        content - The content.
        Returns:
        The Text.
      • getNodeName

        public String getNodeName()

        The name of this node, depending on its type.

        Value: The name of the node.
        Specified by:
        getNodeName in class Node
      • getNodeType

        public int getNodeType()

        A code representing the type of the underlying object.

        Value: The type of the node.
        Specified by:
        getNodeType in class Node
      • cloneNode

        public Node cloneNode(boolean deep)

        Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode is null) and no user data.

        Specified by:
        cloneNode in class Node
        Parameters:
        deep - if set to true [deep].
        Returns:
        Returns node
      • getNodeValue

        public String getNodeValue()

        The value of this node, depending on its type.

        Value: The node value.
        Overrides:
        getNodeValue in class Node
      • getTextContent

        public String getTextContent()

        This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.

        Value: The content of the text.
        Overrides:
        getTextContent in class Node
      • setTextContent

        public void setTextContent(String value)

        This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.

        Value: The content of the text.
        Overrides:
        setTextContent in class Node
      • getLocalName

        public String getLocalName()

        Returns the local part of the qualified name of this node. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as Document.createElement(), this is always null.

        Value: The name of the local.
        Overrides:
        getLocalName in class Node