boolean result;
try
{
result = true;
CSVReader reader = new CSVReader(new FileReader(fullFilename));
String[] nextLine;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
data = builder.newDocument();
Element message = (Element) data.createElement("data");
message.setAttribute("type", Connector_CSV);
while ((nextLine = reader.readNext()) != null)
{
row++;
Element xmlrow = (Element) data.createElement("row");
xmlrow.setAttribute("id", String.valueOf(row));
xmlrow.setNodeValue(String.valueOf(row));
for (int x = 0; x < nextLine.length; x++)
{
col = x + 1;
if (col > maxcol) maxcol = col;
Element xmlcol = addElement(data, "col", nextLine[x]);
xmlcol.setAttribute("id", String.valueOf(col));
xmlcol.setNodeValue(nextLine[x]);
xmlrow.appendChild(xmlcol);
}
message.appendChild(xmlrow);
}
reader.close();
message.setAttribute("type", Connector_CSV);
message.setAttribute("cols", String.valueOf(maxcol));
message.setAttribute("rows", String.valueOf(row));
message.setAttribute("filename", (new File(fullFilename)).getName());