Implement document handler and handler factory.