// Now, find all of the messages in the document
NodeList messages = doc.getElementsByTagName(MESSAGE_TAG);
if (messages != null) {
for (int i = 0; i < messages.getLength(); i++) {
Element msg = (Element) messages.item(i);
MessageEvent msgEvent = new MessageEvent(msg);
// Register a task to dispatch each message later on the
// background thread. (Message handling logic is defined
// by third parties, and we have no guarantee that it will
// finish in a timely manner. We can't risk hanging the