1 /**
2 * Licensed under the Artistic License; you may not use this file
3 * except in compliance with the License.
4 * You may obtain a copy of the License at
5 *
6 * http://displaytag.sourceforge.net/license.html
7 *
8 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
10 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 */
12 package org.displaytag.export;
13
14 import org.apache.commons.lang.StringEscapeUtils;
15 import org.displaytag.model.TableModel;
16
17
18 /**
19 * Export view for xml exporting.
20 * @author Fabrizio Giustina
21 * @version $Revision: 1081 $ ($Author: fgiust $)
22 */
23 public class XmlView extends BaseExportView
24 {
25
26 /**
27 * @see org.displaytag.export.BaseExportView#setParameters(TableModel, boolean, boolean, boolean)
28 */
29 public void setParameters(TableModel tableModel, boolean exportFullList, boolean includeHeader,
30 boolean decorateValues)
31 {
32 super.setParameters(tableModel, exportFullList, includeHeader, decorateValues);
33 }
34
35 /**
36 * @see org.displaytag.export.BaseExportView#getRowStart()
37 */
38 protected String getRowStart()
39 {
40 return "<row>\n"; //$NON-NLS-1$
41 }
42
43 /**
44 * @see org.displaytag.export.BaseExportView#getRowEnd()
45 */
46 protected String getRowEnd()
47 {
48 return "</row>\n"; //$NON-NLS-1$
49 }
50
51 /**
52 * @see org.displaytag.export.BaseExportView#getCellStart()
53 */
54 protected String getCellStart()
55 {
56 return "<column>"; //$NON-NLS-1$
57 }
58
59 /**
60 * @see org.displaytag.export.BaseExportView#getCellEnd()
61 */
62 protected String getCellEnd()
63 {
64 return "</column>\n"; //$NON-NLS-1$
65 }
66
67 /**
68 * @see org.displaytag.export.BaseExportView#getDocumentStart()
69 */
70 protected String getDocumentStart()
71 {
72 return "<?xml version=\"1.0\"?>\n<table>\n"; //$NON-NLS-1$
73 }
74
75 /**
76 * @see org.displaytag.export.BaseExportView#getDocumentEnd()
77 */
78 protected String getDocumentEnd()
79 {
80 return "</table>\n"; //$NON-NLS-1$
81 }
82
83 /**
84 * @see org.displaytag.export.BaseExportView#getAlwaysAppendCellEnd()
85 */
86 protected boolean getAlwaysAppendCellEnd()
87 {
88 return true;
89 }
90
91 /**
92 * @see org.displaytag.export.BaseExportView#getAlwaysAppendRowEnd()
93 */
94 protected boolean getAlwaysAppendRowEnd()
95 {
96 return true;
97 }
98
99 /**
100 * @see org.displaytag.export.ExportView#getMimeType()
101 */
102 public String getMimeType()
103 {
104 return "text/xml"; //$NON-NLS-1$
105 }
106
107 /**
108 * @see org.displaytag.export.BaseExportView#escapeColumnValue(java.lang.Object)
109 */
110 protected String escapeColumnValue(Object value)
111 {
112 return StringEscapeUtils.escapeXml(value.toString());
113 }
114
115 }