class CrescentCollectionHandler {

	public void writeToXML() {
		
		ResourceLoader resourceLoader = new ResourceLoader(collectionsXmlLocation);
		URL collectionXmlUrl = resourceLoader.getURL();
		
		XStream stream = new XStream();
		stream.processAnnotations(CrescentCollections.class);
		
		logger.debug("collectionXmlUrl : {}", collectionXmlUrl);
		
		try {
			
			File collectionsXmlFile = new File(collectionXmlUrl.toURI());
			
			logger.debug("collectionXmlUrl to URI: {}", collectionXmlUrl.toURI());
			logger.debug("collectionsXmlFile : {}", collectionsXmlFile);
			
			FileOutputStream fos = new FileOutputStream(collectionsXmlFile, false);
			BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, Charset.forName("utf-8")));
			
			stream.toXML(this.crescentCollections, bw);
			
			bw.close();
			fos.close();
		
		} catch (URISyntaxException e) {
			e.printStackTrace();
			logger.error("error : ", e);
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			logger.error("error : ", e);
			
		} catch (IOException e) {
			e.printStackTrace();
			logger.error("error : ", e);
			
		}	
	}

}