public void schrijf() 
			throws DbException{
		// Create a XMLOutputFactory
		XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
		// Create XMLEventWriter
		XMLEventWriter eventWriter;
		try {
			eventWriter = outputFactory
					.createXMLEventWriter(new FileOutputStream(handler.getBestand()));
		} catch (FileNotFoundException | XMLStreamException e1) {
			throw new DbException("wrong file");
		}
		// Create a EventFactory
		XMLEventFactory eventFactory = XMLEventFactory.newInstance();
		XMLEvent end = eventFactory.createDTD("\n");
		// Create and write Start Tag
		StartDocument startDocument = eventFactory.createStartDocument();
		try{
			eventWriter.add(startDocument);
			eventWriter.add(end);
			StartElement productenStartElement = eventFactory.createStartElement("","",XmlTags.PRODUCTEN);
			eventWriter.add(productenStartElement);
			eventWriter.add(end);
			// Create product open tag
			ArrayList<Product> producten = handler.getWinkel().getProducten();

			for(Product product: producten)
			{
				if(product.getStaat().getClass().equals(VerwijderdState.class))
					continue;
				eventWriter.add(eventFactory.createStartElement("","",XmlTags.PRODUCT));
				eventWriter.add(end);
				// Write the different nodes
				createNode(eventWriter, XmlTags.TYPE, product.getType());
				createNode(eventWriter, XmlTags.ID, product.getId());
				createNode(eventWriter, XmlTags.TITLE, product.getNaam());
				createNode(eventWriter, XmlTags.BASEPRICE, "" + product.getBasisprijs());
				createNode(eventWriter, XmlTags.STATE, product.getStaat().getClass().getCanonicalName());
				eventWriter.add(eventFactory.createEndElement("", "",XmlTags.PRODUCT));
				eventWriter.add(end);
			}
			eventWriter.add(eventFactory.createEndElement("", "",XmlTags.PRODUCTEN));
			eventWriter.add(eventFactory.createEndDocument());
			eventWriter.close();
		} catch(XMLStreamException e){
			throw new DbException("wrong format");
		}
	}