org.jsoup.nodes.Comment Maven / Gradle / Ivy
The newest version!
package org.jsoup.nodes;
import java.io.IOException;
/**
A comment node.
@author Jonathan Hedley, [email protected] */
public class Comment extends LeafNode {
private static final String COMMENT_KEY = "comment";
/**
Create a new comment node.
@param data The contents of the comment
*/
public Comment(String data) {
value = data;
}
/**
Create a new comment node.
@param data The contents of the comment
@param baseUri base URI not used. This is a leaf node.
@deprecated
*/
public Comment(String data, String baseUri) {
this(data);
}
public String nodeName() {
return "#comment";
}
/**
Get the contents of the comment.
@return comment content
*/
public String getData() {
return coreValue();
}
void outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
if (out.prettyPrint())
indent(accum, depth, out);
accum
.append("");
}
void outerHtmlTail(Appendable accum, int depth, Document.OutputSettings out) {}
@Override
public String toString() {
return outerHtml();
}
}