com.greenpepper.shaded.org.jsoup.nodes.XmlDeclaration Maven / Gradle / Ivy
package com.greenpepper.shaded.org.jsoup.nodes;
/**
An XML Declaration.
@author Jonathan Hedley, [email protected] */
public class XmlDeclaration extends Node {
static final String DECL_KEY = "declaration";
private final boolean isProcessingInstruction; // 1 ) {
StringBuilder sb = new StringBuilder(decl);
final String version = attributes.get("version");
if( version != null ) {
sb.append(" version=\"").append(version).append("\"");
}
final String encoding = attributes.get("encoding");
if( encoding != null ) {
sb.append(" encoding=\"").append(encoding).append("\"");
}
return sb.toString();
}
else {
return attributes.get(DECL_KEY);
}
}
void outerHtmlHead(StringBuilder accum, int depth, Document.OutputSettings out) {
accum
.append("<")
.append(isProcessingInstruction ? "!" : "?")
.append(getWholeDeclaration())
.append(">");
}
void outerHtmlTail(StringBuilder accum, int depth, Document.OutputSettings out) {}
@Override
public String toString() {
return outerHtml();
}
}