All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenpepper.shaded.org.jsoup.nodes.XmlDeclaration Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy