java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java
branchv_0
changeset 206 e2f24eea8543
parent 155 eb3676c6929b
child 207 2bba68ef47c1
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java	Sat Aug 15 10:04:28 2015 +0200
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java	Sat Aug 15 10:20:39 2015 +0200
     1.3 @@ -23,6 +23,9 @@
     1.4  import javax.xml.namespace.QName;
     1.5  import static info.globalcode.sql.dk.Functions.isEmpty;
     1.6  import static info.globalcode.sql.dk.Functions.toHex;
     1.7 +import info.globalcode.sql.dk.configuration.PropertyDeclaration;
     1.8 +import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL;
     1.9 +import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL_DESCRIPTION;
    1.10  import java.nio.charset.Charset;
    1.11  import java.util.EmptyStackException;
    1.12  import java.util.HashMap;
    1.13 @@ -44,10 +47,12 @@
    1.14   *
    1.15   * @author Ing. František Kučera (frantovo.cz)
    1.16   */
    1.17 +@PropertyDeclaration(name = COLORFUL, type = Boolean.class, description = COLORFUL_DESCRIPTION)
    1.18 +@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT, type = String.class, description = "tab or sequence of spaces used for indentation of nested elements")
    1.19 +@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT_TEXT, type = Boolean.class, description = "whether to indent text nodes")
    1.20  public abstract class AbstractXmlFormatter extends AbstractFormatter {
    1.21  
    1.22  	private static final Logger log = Logger.getLogger(AbstractXmlFormatter.class.getName());
    1.23 -	public static final String PROPERTY_COLORFUL = "color";
    1.24  	public static final String PROPERTY_INDENT = "indent";
    1.25  	/**
    1.26  	 * Whether text with line breaks should be indented (default). Otherwise original whitespace
    1.27 @@ -66,7 +71,7 @@
    1.28  
    1.29  	public AbstractXmlFormatter(FormatterContext formatterContext) {
    1.30  		super(formatterContext);
    1.31 -		boolean colorful = formatterContext.getProperties().getBoolean(PROPERTY_COLORFUL, false);
    1.32 +		boolean colorful = formatterContext.getProperties().getBoolean(COLORFUL, false);
    1.33  		out = new ColorfulPrintWriter(formatterContext.getOutputStream(), false, colorful);
    1.34  		indent = formatterContext.getProperties().getString(PROPERTY_INDENT, "\t");
    1.35  		indentText = formatterContext.getProperties().getBoolean(PROPERTY_INDENT_TEXT, true);