public Document parseDocument(String xml) throws DocumentException {
        /*
        // Long way with reuse of DocumentFactory.
        DocumentFactory df = getDocumentFactory();
        SAXReader reader = new SAXReader( df );
        Document document = reader.read( new StringReader( xml );*/

        // Simple way
        // TODO Optimize. Do not create a sax reader for each parsing
        Document document = DocumentHelper.parseText(xml);

        return document;
    }
Returns the last time a full Document was read or a heartbeat was received. Hearbeats
are represented as whitespaces or \n received while a Document is not being parsed.

@return the time in milliseconds when the last document or heartbeat was received.
xmppserver/src/main/java/org/dom4j/io/XMPPPacketReader.java