Java Code Examples for org.dom4j.Element.appendContent()

The following are Jave code examples for showing how to use appendContent() of the org.dom4j.Element class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: gitplex-mit   File:   View Source Code Vote up 6 votes
private void exportEntity(Session session, Class<?> entityType, List<Long> ids, int start, int count, int batchSize, File exportDir) {"Loading table rows ({}->{}) from database...", String.valueOf(start+1), (start + count));
	Query query = session.createQuery("from " + entityType.getSimpleName() + " where id>=:fromId and id<=:toId");
	query.setParameter("fromId", ids.get(start));
	query.setParameter("toId", ids.get(start+count-1));"Converting table rows to XML...");
	VersionedDocument dom = new VersionedDocument();
	Element rootElement = dom.addElement("list");
	for (Object entity: query.list())
	String fileName;

	if (start == 0)
		fileName = entityType.getSimpleName() + "s.xml";
		fileName = entityType.getSimpleName() + "s.xml." + (start/batchSize + 1);"Writing resulting XML to file '" + fileName + "...");
	dom.writeToFile(new File(exportDir, fileName), true);