public final void write(File xmlFile, ArrayList<Person> firsts,
			ArrayList<Person> recurrings) throws Exception {
		DocumentBuilderFactory docFactory = DocumentBuilderFactory
				.newInstance();
		DocumentBuilder docBuilder = docFactory.newDocumentBuilder();

		Document doc = docBuilder.newDocument();
		doc.setXmlStandalone(true);

		// Document
		Element document = createDocumentElem(doc);
		doc.appendChild(document);

		// CstmrDrctDbtInitn
		Element root = doc.createElement("CstmrDrctDbtInitn");
		document.appendChild(root);

		// GrpHdr
		Element header = createGrpHdrElem(doc, firsts, recurrings);
		root.appendChild(header);

		// FIRSTS
		// PmtInf
		if (firsts.size() > 0) {
			Element pmtInfFirst = doc.createElement("PmtInf");
			appendPmtInfHdr(pmtInfFirst, doc, firsts,
					StaticString.PERSONS_FIRST);
			appendCdtr(pmtInfFirst, doc);

			Element dbtrFirst;
			for (Person p : firsts) {
				dbtrFirst = createDbtr(p, doc);
				pmtInfFirst.appendChild(dbtrFirst);
			}

			root.appendChild(pmtInfFirst);
		}

		// RECURRINGS
		// PmtInf
		if (recurrings.size() > 0) {
			Element pmtInfRec = doc.createElement("PmtInf");
			appendPmtInfHdr(pmtInfRec, doc, recurrings,
					StaticString.PERSONS_RECURRING);
			appendCdtr(pmtInfRec, doc);

			Element dbtrRec;
			for (Person p : recurrings) {
				dbtrRec = createDbtr(p, doc);
				pmtInfRec.appendChild(dbtrRec);
			}

			root.appendChild(pmtInfRec);
		}

		// XML schreiben
		TransformerFactory transformerFactory = TransformerFactory
				.newInstance();
		Transformer transformer = transformerFactory.newTransformer();
		DOMSource source = new DOMSource(doc);
		StreamResult result = new StreamResult(xmlFile);
		transformer.transform(source, result);
	}