--- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java Wed Jan 08 23:39:47 2014 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java Wed Jan 08 23:50:22 2014 +0100
@@ -90,7 +90,7 @@
}
protected Map<QName, String> singleAttribute(QName name, String value) {
- Map<QName, String> attributes = new HashMap<>(1);
+ Map<QName, String> attributes = new HashMap<>(2);
attributes.put(name, value);
return attributes;
}
--- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/XhtmlFormatter.java Wed Jan 08 23:39:47 2014 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/XhtmlFormatter.java Wed Jan 08 23:50:22 2014 +0100
@@ -28,7 +28,6 @@
import java.sql.Array;
import java.sql.SQLException;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
@@ -69,9 +68,7 @@
super.writeStartBatch();
printStartDocument();
printDoctype(DOCTYPE);
- Map<QName, String> attributes = new HashMap<>(1);
- attributes.put(qname("xmlns"), Xmlns.XHTML);
- printStartElement(qname("html"), attributes);
+ printStartElement(qname("html"), singleAttribute(qname("xmlns"), Xmlns.XHTML));
printStartElement(qname("head"));
printTextElement(qname("title"), null, Constants.PROGRAM_NAME + ": batch results");
@@ -84,9 +81,7 @@
private void printCss() {
try (Scanner css = new Scanner(getClass().getClassLoader().getResourceAsStream(CSS_FILE))) {
- Map<QName, String> attributes = new HashMap<>(1);
- attributes.put(qname("type"), "text/css");
- printStartElement(qname("style"), attributes);
+ printStartElement(qname("style"), singleAttribute(qname("type"), "text/css"));
while (css.hasNext()) {
printText(css.nextLine(), true);
}
@@ -173,11 +168,11 @@
printTableData(String.valueOf(value));
}
} else {
- Map<QName, String> attributes = new HashMap<>(1);
+ Map<QName, String> attributes = null;
if (value instanceof Number) {
- attributes.put(qname("class"), "number");
+ attributes = singleAttribute(qname("class"), "number");
} else if (value instanceof Boolean) {
- attributes.put(qname("class"), "boolean");
+ attributes = singleAttribute(qname("class"), "boolean");
}
printTextElement(qname("td"), attributes, String.valueOf(value));
}