public void generateXml(String name, HashMap<Integer, Integer> oneRes) {
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		try {
			DocumentBuilder db = dbf.newDocumentBuilder();
			Document document = db.newDocument();

			Element root = document.createElement("clustering");
			root.setAttribute("name", name);
			document.appendChild(root);

			HashMap<Integer, Set<Integer>> entityMap = new HashMap<Integer, Set<Integer>>();
			Iterator iter = oneRes.entrySet().iterator();
			while (iter.hasNext()) {
				Map.Entry entry = (Map.Entry) iter.next();
				int rank = (Integer) entry.getKey();
				int entity = (Integer) entry.getValue();
				if (entityMap.containsKey(entity)) {
					Set<Integer> temp = entityMap.get(entity);
					temp.add(rank);
				} else {
					Set<Integer> temp = new HashSet();
					temp.add(rank);
					entityMap.put(entity, temp);
				}
			}
			iter = entityMap.entrySet().iterator();
			while (iter.hasNext()) {
				Map.Entry entry = (Map.Entry) iter.next();
				int entityNum = (Integer) entry.getKey();
				Element entity = document.createElement("entity");
				entity.setAttribute("id", String.valueOf(entityNum));
				root.appendChild(entity);

				HashSet<Integer> set = (HashSet) entry.getValue();
				Iterator<Integer> it = set.iterator();
				while (it.hasNext()) {
					Integer rank = it.next();
					Element doc = document.createElement("doc");
					doc.setAttribute("rank", String.valueOf(rank));
					entity.appendChild(doc);
				}
			}

			File f = new File("result/" + name + ".clust.xml");
			Transformer t = TransformerFactory.newInstance().newTransformer();
			t.setOutputProperty("indent", "yes");
			t.transform(new DOMSource(document), new StreamResult(
					new FileOutputStream(f)));

		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (TransformerConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (TransformerFactoryConfigurationError e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (TransformerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}