Added beginDocument() and endDocument callbacks.