public static BaseMsg getMsgFromDoc(Document doc) throws Exception {

		String toUserName = getTagValue("ToUserName", doc);
		String fromUserName = getTagValue("FromUserName", doc);
		String rawCreateTime = getTagValue("CreateTime", doc);
		long createTime = Long.parseLong(rawCreateTime);

		String msgType = getTagValue("MsgType", doc);

		BaseMsg msg;

		if (msgType.equals(RespType.TEXT)) {
			String content = getTagValue("Content", doc);
			msg = MessageFactory.createTextMsg(content);
		} else if (msgType.equals(RespType.NEWS)) {

			NewsMsg newsMsg = MessageFactory.createNewsMsg();

			Elements items = doc.getElementsByTag("item");
			for (Element item : items) {
				String title = getTagValue("Title", item);
				String description = getTagValue("Description", item);
				String picUrl = getTagValue("PicUrl", item);
				String Url = getTagValue("Url", item);

				newsMsg.add(title, description, picUrl, Url);
			}
			msg = newsMsg;
		} else if (msgType.equals(RespType.IMAGE)) {
			String mediaId = getTagValue("MediaId", doc);
			msg = MessageFactory.createImageMsg(mediaId);
		} else if (msgType.equals(RespType.VOICE)) {
			String mediaId = getTagValue("MediaId", doc);
			msg = MessageFactory.createVoiceMsg(mediaId);
		} else if (msgType.equals(RespType.VIDEO)) {
			String mediaId = getTagValue("MediaId", doc);
			String title = getTagValue("Title", doc);
			String description = getTagValue("Description", doc);
			msg = MessageFactory.createVideoMsg(mediaId, title, description);
		} else if (msgType.equals(RespType.MUSIC)) {
			String title = getTagValue("Title", doc);
			String description = getTagValue("Description", doc);
			String musicUrl = getTagValue("MusicUrl", doc);
			String hqMusicUrl = getTagValue("HQMusicUrl", doc);
			String thumbMediaId = getTagValue("ThumbMediaId", doc);
			msg = MessageFactory.createMusicMsg(thumbMediaId, title,
					description, musicUrl, hqMusicUrl);
		} else {
			return null;
		}

		msg.setFromUserName(fromUserName);
		msg.setToUserName(toUserName);
		msg.setCreateTime(createTime);

		return msg;
	}