/* * Generate a simple XML output */ package art.output; import java.io.*; public class xmlOutput implements artOutputInterface { PrintWriter out; int numberOfLines = 0; String queryName; String userName; int maxRows; int columns; public xmlOutput(){ } public String getFileName() { return null; // this output mode does not generate external files } public String getName(){ return "XML"; // simple label } public String getContentType(){ return "application/xml"; // mime type (use "text/html" for html) } public void setWriter(PrintWriter o){ out = o; } public void setQueryName(String s){ queryName = s; } public void setUserName(String s){ userName = s; } public void setMaxRows(int i){ maxRows = i; } public void setColumnsNumber(int i){ columns = i; // unused in this output mode } public void setExportPath(String s) {}; // not needed as this output type does not generate a file public void setLogPath(String s) {}; // not needed as this output type does not generate logs public void beginHeader() { out.println(""); out.println(""); out.println(""); } public void addHeaderCell(String s){ out.println("" + s + ""); } public void endHeader() { out.println(""); } public void beginLines() { out.println(""); } public void addCellString(String s) { out.println("" + s + ""); } public void addCellDouble(double d){ out.println("" + d + ""); } public void addCellInt(int i){ out.println("" + i + ""); } public void addCellDate(java.sql.Date d){ out.println("" + d + ""); } public boolean newLine(){ numberOfLines++; if (numberOfLines < maxRows) { out.println(""); return true; } else { out.println(""); out.println("Too many rows"); out.println("
"); return false; // ART will stop to feed the object if it returns false } } public void endLines() { out.println(""+numberOfLines+""); out.println(""); out.println(""); } public boolean isDefaultHtmlHeaderAndFooterEnabled() { return false; // if set to true, art will add an html header&footer around the output } }