1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/XmlFormatter.java Sat Aug 15 10:04:28 2015 +0200
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/XmlFormatter.java Sat Aug 15 10:20:39 2015 +0200
1.3 @@ -22,6 +22,7 @@
1.4 import info.globalcode.sql.dk.configuration.DatabaseDefinition;
1.5 import static info.globalcode.sql.dk.Functions.notNull;
1.6 import info.globalcode.sql.dk.NamedParameter;
1.7 +import info.globalcode.sql.dk.configuration.PropertyDeclaration;
1.8 import static info.globalcode.sql.dk.formatting.AbstractXmlFormatter.qname;
1.9 import java.sql.Array;
1.10 import java.sql.SQLException;
1.11 @@ -33,13 +34,16 @@
1.12 import javax.xml.namespace.QName;
1.13
1.14 /**
1.15 - * <p>Prints machine-readable output – XML document containing resultsets and updates count. Good
1.16 + * <p>
1.17 + * Prints machine-readable output – XML document containing resultsets and updates count. Good
1.18 * choice for further processing – e.g. XSL transformation.</p>
1.19 *
1.20 - * <p>TODO: XSD</p>
1.21 + * <p>
1.22 + * TODO: XSD</p>
1.23 *
1.24 * @author Ing. František Kučera (frantovo.cz)
1.25 */
1.26 +@PropertyDeclaration(name = XmlFormatter.PROPERTY_LABELED_COLUMNS, type = Boolean.class, description = "whether to add 'label' attribute to each 'column' element")
1.27 public class XmlFormatter extends AbstractXmlFormatter {
1.28
1.29 public static final String NAME = "xml"; // bash-completion:formatter
1.30 @@ -158,9 +162,7 @@
1.31 attributes.put(qname("null"), "true");
1.32 printEmptyElement(qname("column"), attributes);
1.33 } else if (value instanceof Array) {
1.34 -
1.35 -
1.36 -
1.37 +
1.38 Array sqlArray = (Array) value;
1.39 try {
1.40 Object[] array = (Object[]) sqlArray.getArray();
1.41 @@ -171,13 +173,12 @@
1.42 log.log(Level.SEVERE, "Unable to format array", e);
1.43 writeColumnValue(String.valueOf(value));
1.44 }
1.45 -
1.46 -
1.47 +
1.48 } else {
1.49 printTextElement(qname("column"), attributes, toString(value));
1.50 }
1.51 }
1.52 -
1.53 +
1.54 private void printArray(Object[] array) {
1.55 printStartElement(qname("array"));
1.56 for (Object o : array) {