Package org.jdom

Class Comment

All Implemented Interfaces:
Serializable, Cloneable

public class Comment extends Content
An XML comment. Methods allow the user to get and set the text of the comment.
Version:
$Revision: 1.33 $, $Date: 2007/11/10 05:28:58 $
Author:
Brett McLaughlin, Jason Hunter
See Also:
  • Field Details

    • text

      protected String text
      Text of the Comment
  • Constructor Details

    • Comment

      protected Comment()
      Default, no-args constructor for implementations to use if needed.
    • Comment

      public Comment(String text)
      This creates the comment with the supplied text.
      Parameters:
      text - String content of comment.
  • Method Details

    • getValue

      public String getValue()
      Returns the XPath 1.0 string value of this element, which is the text of this comment.
      Specified by:
      getValue in class Content
      Returns:
      the text of this comment
    • getText

      public String getText()
      This returns the textual data within the Comment.
      Returns:
      String - text of comment.
    • setText

      public Comment setText(String text)
      This will set the value of the Comment.
      Parameters:
      text - String text for comment.
      Returns:
      Comment - this Comment modified.
      Throws:
      IllegalDataException - if the given text is illegal for a Comment.
    • toString

      public String toString()
      This returns a String representation of the Comment, suitable for debugging. If the XML representation of the Comment is desired, XMLOutputter.outputString(Comment) should be used.
      Overrides:
      toString in class Object
      Returns:
      String - information about the Attribute