01: /*
02: * XmlExportWriter.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.exporter;
13:
14: import workbench.log.LogMgr;
15: import workbench.util.XsltTransformer;
16:
17: /**
18: *
19: * @author support@sql-workbench.net
20: */
21: public class XmlExportWriter extends ExportWriter {
22: public XmlExportWriter(DataExporter exp) {
23: super (exp);
24: }
25:
26: public RowDataConverter createConverter() {
27: return new XmlRowDataConverter();
28: }
29:
30: public void configureConverter() {
31: super .configureConverter();
32: XmlRowDataConverter conv = (XmlRowDataConverter) this .converter;
33: conv.setUseCDATA(this .exporter.getUseCDATA());
34: conv.setLineEnding(exporter.getLineEnding());
35: conv.setUseVerboseFormat(exporter.getUseVerboseFormat());
36: conv.setTableNameToUse(exporter.getTableName());
37: conv.setWriteClobToFile(exporter.getWriteClobAsFile());
38: //conv.setBaseFilename(exporter.getOutputFilename());
39: }
40:
41: public void exportFinished() {
42: super .exportFinished();
43: String exportFile = this .exporter.getFullOutputFilename();
44: String xsltFile = this .exporter.getXsltTransformation();
45: String output = this .exporter.getXsltTransformationOutput();
46: if (xsltFile != null && output != null) {
47: try {
48: XsltTransformer.transformFile(exportFile, output,
49: xsltFile);
50: } catch (Exception e) {
51: LogMgr.logError("DataSpooler.startExport()",
52: "Error when transforming " + output + " using "
53: + xsltFile, e);
54: }
55: }
56: }
57: }
|