# HG changeset patch # User František Kučera # Date 1389221422 -3600 # Node ID 7a3382823fc31f6c16f5bc60fcda262982b743f9 # Parent 21eb46c5e2ec76438db0fd382c29e90841ce78e2 XML formatter: use singleAttribute(qname(""), "") diff -r 21eb46c5e2ec -r 7a3382823fc3 java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java --- 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 singleAttribute(QName name, String value) { - Map attributes = new HashMap<>(1); + Map attributes = new HashMap<>(2); attributes.put(name, value); return attributes; } diff -r 21eb46c5e2ec -r 7a3382823fc3 java/sql-dk/src/info/globalcode/sql/dk/formatting/XhtmlFormatter.java --- 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 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 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 attributes = new HashMap<>(1); + Map 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)); }