public static Long parse(String file) throws ParserConfigurationException,
			SAXException, IOException, DOMException, ParseException {
		File fXmlFile = new File(file);
		DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
		Document doc = dBuilder.parse(fXmlFile);

		doc.getDocumentElement().normalize();

		Map<String, User> userMap = new HashMap<String, User>();
		Map<String, Topic> topicMap = new HashMap<String, Topic>();
		Map<String, Date> topicCreationDateMap = new HashMap<String, Date>();
		List<Post> posts = new ArrayList<Post>();

		DateFormat postDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm");
		DateFormat userDateFormat = new SimpleDateFormat("dd MMM yyyy");

		NodeList nList = doc.getElementsByTagName("task_result");
		for (int i = 0; i < nList.getLength(); ++i) {
			Element taskResult = (Element) nList.item(i);

			String userLogin = getValue(taskResult, USER_LOGIN_NODE_NR);
			User user = userMap.get(userLogin);
			if (user == null) {
				user = new User();
				user.setLogin(userLogin);
				if (!"nieznajomy"
						.equals(getValue(taskResult, USER_DATA_NODE_NR))) {
					user.setCity(getValueFromField(taskResult,
							USER_DATA_NODE_NR, "Skąd"));
					user.setCreationDate(userDateFormat
							.parse(getValueFromField(taskResult,
									USER_DATA_NODE_NR, "Dołączył(a)")));
				}
				userMap.put(userLogin, user);
			}

			String topicName = getValueFromField(taskResult,
					TOPIC_NAME_NODE_NR, "Temat");
			Topic topic = topicMap.get(topicName);
			if (topic == null) {
				topic = new Topic();
				topic.setTopicName(topicName);
				topic.setUser(user);
				topicMap.put(topicName, topic);
			}

			Post post = new Post();
			post.setTopic(topic);
			post.setUser(user);
			if (getValueFromField(taskResult, POST_DATE_NODE_NR, "Wysłany")
					.startsWith("Dzisiaj o")) {
				post.setCreationDate(postDateFormat.parse("2014-10-4 "
						+ getValueFromField(taskResult, POST_DATE_NODE_NR,
								"Wysłany").split(" ")[2]));
			} else if (getValueFromField(taskResult, POST_DATE_NODE_NR,
					"Wysłany").startsWith("Wczoraj o")) {
				post.setCreationDate(postDateFormat.parse("2014-09-4 "
						+ getValueFromField(taskResult, POST_DATE_NODE_NR,
								"Wysłany").split(" ")[2]));
			} else {
				post.setCreationDate(postDateFormat.parse(getValueFromField(
						taskResult, POST_DATE_NODE_NR, "Wysłany")));
			}

			Date topicCreationDate = topicCreationDateMap.get(topic
					.getTopicName());
			if (topicCreationDate == null
					|| post.getCreationDate().before(topicCreationDate)) {
				topicCreationDateMap.put(topic.getTopicName(),
						post.getCreationDate());
			}

			post.setText(taskResult.getChildNodes().item(POST_CONTENT_NODE_NR)
					.getTextContent().trim());
			posts.add(post);
		}
		for (String topicName : topicCreationDateMap.keySet()) {
			topicMap.get(topicName).setCreationDate(
					topicCreationDateMap.get(topicName));
		}
		Long start = System.currentTimeMillis();

		PostDAO.persist(posts);

		Long end = System.currentTimeMillis();

		return end - start;

	}