class SpecificationReader {

	protected Application<Task, Dependency> toApplication(nu.xom.Element eApplication)
			throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException,
			InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
		Application<Task, Dependency> application = new Application<Task, Dependency>();

		nu.xom.Elements eTasks = eApplication.getChildElements("task", SpecificationWriter.NS);
		for (nu.xom.Element eTask : iterable(eTasks)) {
			Task task = toNode(eTask, null);
			application.addVertex(task);
		}
		nu.xom.Elements eCommunications = eApplication.getChildElements("communication", SpecificationWriter.NS);
		for (nu.xom.Element eCommunication : iterable(eCommunications)) {
			Communication communication = toNode(eCommunication, null);
			application.addVertex(communication);
		}

		nu.xom.Elements eDependencies = eApplication.getChildElements("dependency", SpecificationWriter.NS);
		for (nu.xom.Element eDependency : iterable(eDependencies)) {
			parseDependency(eDependency, application);
		}

		nu.xom.Element eFunctions = eApplication.getFirstChildElement("functions", SpecificationWriter.NS);
		if (eFunctions != null) {
			nu.xom.Elements eFuncs = eFunctions.getChildElements("function", SpecificationWriter.NS);
			for (nu.xom.Element eFunc : iterable(eFuncs)) {
				Task task = application.getVertex(eFunc.getAttributeValue("anchor"));
				Function<Task, Dependency> function = application.getFunction(task);
				Attributes attributes = toAttributes(eFunc.getFirstChildElement("attributes", SpecificationWriter.NS));
				setAttributes(function, attributes);
			}
		}

		return application;
	}

}