--- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/XmlFormatter.java Sat Aug 15 10:04:28 2015 +0200
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/XmlFormatter.java Sat Aug 15 10:20:39 2015 +0200
@@ -22,6 +22,7 @@
import info.globalcode.sql.dk.configuration.DatabaseDefinition;
import static info.globalcode.sql.dk.Functions.notNull;
import info.globalcode.sql.dk.NamedParameter;
+import info.globalcode.sql.dk.configuration.PropertyDeclaration;
import static info.globalcode.sql.dk.formatting.AbstractXmlFormatter.qname;
import java.sql.Array;
import java.sql.SQLException;
@@ -33,13 +34,16 @@
import javax.xml.namespace.QName;
/**
- * <p>Prints machine-readable output – XML document containing resultsets and updates count. Good
+ * <p>
+ * Prints machine-readable output – XML document containing resultsets and updates count. Good
* choice for further processing – e.g. XSL transformation.</p>
*
- * <p>TODO: XSD</p>
+ * <p>
+ * TODO: XSD</p>
*
* @author Ing. František Kučera (frantovo.cz)
*/
+@PropertyDeclaration(name = XmlFormatter.PROPERTY_LABELED_COLUMNS, type = Boolean.class, description = "whether to add 'label' attribute to each 'column' element")
public class XmlFormatter extends AbstractXmlFormatter {
public static final String NAME = "xml"; // bash-completion:formatter
@@ -158,9 +162,7 @@
attributes.put(qname("null"), "true");
printEmptyElement(qname("column"), attributes);
} else if (value instanceof Array) {
-
-
-
+
Array sqlArray = (Array) value;
try {
Object[] array = (Object[]) sqlArray.getArray();
@@ -171,13 +173,12 @@
log.log(Level.SEVERE, "Unable to format array", e);
writeColumnValue(String.valueOf(value));
}
-
-
+
} else {
printTextElement(qname("column"), attributes, toString(value));
}
}
-
+
private void printArray(Object[] array) {
printStartElement(qname("array"));
for (Object o : array) {