public Document createDocument(final List<Student> students) {

		Document doc = null;
		try {
			final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			dbf.setValidating(true);
			final DocumentBuilder db = dbf.newDocumentBuilder();
			doc = db.newDocument();
			final Element root = doc.createElement(Model.FIELD_STUDENTS);
			for (final Student student : students) {
				final Element studentElement = doc.createElement(Model.FIELD_STUDENT);
				root.appendChild(studentElement);
				newElement(doc, Model.FIELD_NAME, studentElement, student.getName());
				newElement(doc, Model.FIELD_GROUP, studentElement, student.getGroup()
						.toString());
				final List<Exam> exams = student.getExams();
				final Element examsElement = doc.createElement(Model.FIELD_EXAMS);
				studentElement.appendChild(examsElement);
				for (final Exam exam : exams) {
					if (!exam.isEmpty()) {
						final Element examElement = doc.createElement(Model.FIELD_EXAM);
						examsElement.appendChild(examElement);
						newElement(doc, Model.FIELD_NAME, examElement,
								exam.getName() != null ? exam.getName() : " ");
						newElement(doc, Model.FIELD_MARK, examElement,
								exam.getMark() != null ? exam.getMark().toString() : " ");
					}
				}
			}
			doc.appendChild(root);
		} catch (final Exception e) {
			XMLWriter.LOG
					.log(Level.SEVERE,
							Window.geti18nString(Model.PROBLEM_PARSING_THE_FILE)
									+ e.getMessage(), e);
		}
		return doc;
	}