1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/XmlFormatter.java Sat Jan 04 20:08:56 2014 +0100
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/XmlFormatter.java Sat Jan 04 20:24:27 2014 +0100
1.3 @@ -35,9 +35,12 @@
1.4 public class XmlFormatter extends AbstractXmlFormatter {
1.5
1.6 public static final String NAME = "xml"; // bash-completion:formatter
1.7 + public static final String PROPERTY_LABELED_COLUMNS = "labeledColumns";
1.8 + private final boolean labeledColumns;
1.9
1.10 public XmlFormatter(FormatterContext formatterContext) {
1.11 super(formatterContext);
1.12 + labeledColumns = formatterContext.getProperties().getBoolean(PROPERTY_LABELED_COLUMNS, false);
1.13 }
1.14
1.15 @Override
1.16 @@ -126,7 +129,14 @@
1.17 @Override
1.18 public void writeColumnValue(Object value) {
1.19 super.writeColumnValue(value);
1.20 - printTextElement(qname("column"), null, toString(value));
1.21 +
1.22 + Map<QName, String> attributes = null;
1.23 + if (labeledColumns) {
1.24 + attributes = new LinkedHashMap<>(1);
1.25 + attributes.put(qname("label"), getCurrentColumnsHeader().getColumnDescriptors().get(getCurrentColumnsCount() - 1).getLabel());
1.26 + }
1.27 +
1.28 + printTextElement(qname("column"), attributes, toString(value));
1.29 }
1.30
1.31 @Override