Class TextNode

java.lang.Object
com.oorian.xml.TextNode
All Implemented Interfaces:
XmlNode

public class TextNode extends Object implements XmlNode
Represents a text node within an XML document.

TextNode contains plain text content that appears within an XML element. Special characters are automatically escaped when the node is serialized to XML format.

Since:
2020
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • TextNode

      public TextNode(String text)
      Constructs a new TextNode with the specified text content.
      Parameters:
      text - the text content.
  • Method Details

    • getText

      public String getText()
      Returns the text content.
      Returns:
      The text content
    • setText

      public void setText(String text)
      Sets the text content.
      Parameters:
      text - The new text content
    • toXmlString

      public String toXmlString(int indent)
      Description copied from interface: XmlNode
      Returns the XML string representation of this node with the specified indentation level.
      Specified by:
      toXmlString in interface XmlNode
      Parameters:
      indent - the indentation level (number of two-space indents).
      Returns:
      the formatted XML string.
    • toString

      public String toString()
      Overrides:
      toString in class Object