public void writeEvents(File file)
    {
	FileOutputStream fos=null;
	OutputStreamWriter osw=null;
	PrintWriter writer=null;
	try	   
	    {
		fos=new FileOutputStream(file);
		osw=new OutputStreamWriter(fos,"UTF8");
		writer=new PrintWriter(osw);
		writer.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
		writer.println("<?xml-stylesheet type=\"text/xsl\" href=\"style.xsl\"?>");
		writer.println("<catalog>");
		writer.println("<title>"+title+"</title>");
		EventItem item;
		for(int i=0;i<events.size();i++)
		    {
			item=events.get(i);
			if(item.caption!=null)
			    item.writeEvent(writer);
		    }

		writer.println("</catalog>");		
		writer.close();
	    }
	catch(Exception e){e.printStackTrace();}
	finally
	    {
		try
		    {
			if(writer!=null)
			    writer.close();
			else if(osw!=null)
			    osw.close();
			else if(fos!=null)
			    fos.close();
		    }
		catch(Exception e){e.printStackTrace();}
	    }
    }