// assign elements and attributes
Element root = xmlDoc.createElement("workflow");
root.setAttribute("message", message);
root.setAttribute("sender", username);
root.setAttribute("status", status);
xmlDoc.appendChild(root);
// write document to a String and send as a JMS text message
StringWriter sw = new StringWriter();
try {
xmlDoc.write(sw);