rec.setNameValuePairs((String) record.get(fieldIdx++));
rec.setMessageID((String) record.get(fieldIdx++));
rec.setMessage((String) record.get(fieldIdx++));
if (type.equals("json")) {
sb.append(sep);
sb.append(rec.toJSON());
sep = ",";
} else {
sb.append(rec.toXML());
}