public void generate(int files, int payments) {

		int x;
		int y;
		int total = 0;

		try {

			DocumentBuilderFactory docFactory = DocumentBuilderFactory
					.newInstance();
			DocumentBuilder docBuilder = docFactory.newDocumentBuilder();

			for (x = 0; x < files; x++) {
				Document doc = docBuilder.newDocument();
				Element rootElement = doc.createElement("PAYMENTS");
				doc.appendChild(rootElement);
				for (y = 0; y < payments; y++) {

					++total;

					String payer = "payer" + total;
					String recipient = "recipient" + total;
					String details = "details" + total;

					Element payment = doc.createElement("payment");
					rootElement.appendChild(payment);
					switch (y % 3) {
					case 0:
						addPhysicalElements(doc, payment, payer,
								"physical_payer");
						addPhysicalElements(doc, payment, recipient,
								"physical_recipient");
						addDetailsElements(doc, payment, details);
						break;
					case 1:
						addLegalElements(doc, payment, payer, "legal_payer");
						addLegalElements(doc, payment, recipient,
								"legal_recipient");
						addDetailsElements(doc, payment, details);
						break;
					case 2:
						addPhysicalElements(doc, payment, payer,
								"physical_payer");
						addLegalElements(doc, payment, recipient,
								"legal_recipient");
						addDetailsElements(doc, payment, details);
					}

				}

				TransformerFactory transformerFactory = TransformerFactory
						.newInstance();
				Transformer transformer = transformerFactory.newTransformer();
				DOMSource source = new DOMSource(doc);
				String fileFullPath = GENERATE_PATH + x + ".xml";
				StreamResult result = new StreamResult(new File(fileFullPath));

				transformer.transform(source, result);

				logger.debug("File {} successfully generated!", fileFullPath);
			}
		} catch (ParserConfigurationException pce) {
			pce.printStackTrace();
		} catch (TransformerException tfe) {
			tfe.printStackTrace();
		}
	}