java/sql-dk/src/info/globalcode/sql/dk/formatting/XhtmlFormatter.java
branchv_0
changeset 152 7a3382823fc3
parent 142 da1e38386d84
child 155 eb3676c6929b
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/XhtmlFormatter.java	Wed Jan 08 23:39:47 2014 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/XhtmlFormatter.java	Wed Jan 08 23:50:22 2014 +0100
     1.3 @@ -28,7 +28,6 @@
     1.4  import java.sql.Array;
     1.5  import java.sql.SQLException;
     1.6  import java.util.Date;
     1.7 -import java.util.HashMap;
     1.8  import java.util.List;
     1.9  import java.util.Map;
    1.10  import java.util.Scanner;
    1.11 @@ -69,9 +68,7 @@
    1.12  		super.writeStartBatch();
    1.13  		printStartDocument();
    1.14  		printDoctype(DOCTYPE);
    1.15 -		Map<QName, String> attributes = new HashMap<>(1);
    1.16 -		attributes.put(qname("xmlns"), Xmlns.XHTML);
    1.17 -		printStartElement(qname("html"), attributes);
    1.18 +		printStartElement(qname("html"), singleAttribute(qname("xmlns"), Xmlns.XHTML));
    1.19  
    1.20  		printStartElement(qname("head"));
    1.21  		printTextElement(qname("title"), null, Constants.PROGRAM_NAME + ": batch results");
    1.22 @@ -84,9 +81,7 @@
    1.23  	private void printCss() {
    1.24  
    1.25  		try (Scanner css = new Scanner(getClass().getClassLoader().getResourceAsStream(CSS_FILE))) {
    1.26 -			Map<QName, String> attributes = new HashMap<>(1);
    1.27 -			attributes.put(qname("type"), "text/css");
    1.28 -			printStartElement(qname("style"), attributes);
    1.29 +			printStartElement(qname("style"), singleAttribute(qname("type"), "text/css"));
    1.30  			while (css.hasNext()) {
    1.31  				printText(css.nextLine(), true);
    1.32  			}
    1.33 @@ -173,11 +168,11 @@
    1.34  				printTableData(String.valueOf(value));
    1.35  			}
    1.36  		} else {
    1.37 -			Map<QName, String> attributes = new HashMap<>(1);
    1.38 +			Map<QName, String> attributes = null;
    1.39  			if (value instanceof Number) {
    1.40 -				attributes.put(qname("class"), "number");
    1.41 +				attributes = singleAttribute(qname("class"), "number");
    1.42  			} else if (value instanceof Boolean) {
    1.43 -				attributes.put(qname("class"), "boolean");
    1.44 +				attributes = singleAttribute(qname("class"), "boolean");
    1.45  			}
    1.46  			printTextElement(qname("td"), attributes, String.valueOf(value));
    1.47  		}