public int insert(List<DBRow> rows) throws Exception{
		
		File table = new File("Databases/" + name + ".xml");
		if(!table.exists())
			throw new Exception("The table " + name + " doesn't exist.");
		
		SAXBuilder builder = new SAXBuilder();
		Document document = null;
		try {
	 
			document = (Document) builder.build(table);
			Element rootNode = document.getRootElement();
			this.nextIndex = Integer.parseInt(rootNode.getAttributeValue("nextIndex"));
			
			Element rowsTag = rootNode.getChild("rows");
			Element rowElement = null;
			
			for(DBRow row : rows){
				rowElement = new Element("row");
				for(DBItem item : row.getItems()){
					Column column;
					if((column = columns.get(item.getColumn())) != null){
						if(column.getType().validate(item.getValue())){
							Element value = new Element("value");
							value.setAttribute("column", column.getName());
							value.setText(item.getValue().toString());
							rowElement.addContent(value);
						}else
							System.out.println("Not valid! " + column.getName());
					}
				}
				Element index = new Element("value");
				index.setAttribute("column", this.indexColumn);
				index.setText(nextIndex++ + "");
				rootNode.setAttribute("nextIndex", nextIndex + "");
				rowElement.addContent(index);
				rowsTag.addContent(rowElement);
			}
	 
		} catch (IOException io) {
			System.out.println(io.getMessage());
		} catch (JDOMException jdomex) {
			System.out.println(jdomex.getMessage());
		}
		
		XMLOutputter xmlOutput = new XMLOutputter();
		 
		// display nice nice
		xmlOutput.setFormat(Format.getPrettyFormat());
		try {
			xmlOutput.output(document, new FileWriter(table));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return nextIndex-1;
		
	}