public static List<Generator> ReadXmlfile(String xmlfile)
	{
		List<Generator> generators = null;
		
		File file = new File(xmlfile);
		try
		{
			generators = new ArrayList<Generator>();
				
			// Create a factory
	        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
	        // Use the factory to create a builder
	        DocumentBuilder builder = factory.newDocumentBuilder();
	        Document doc = builder.parse(file);
	        
	        doc.normalize();
	        
	        NodeList generlist = doc.getElementsByTagName(GENERATOR);
	        
	        NodeList nodelist, elemgrplist;
	        String name, path, importfile, exportfile;
	        //String inputfile;
	    	Element generelem, elem;
	    	int i;
	       	
	    	//traverse each generator
	        for (i = 0; i < generlist.getLength(); i++)
	        {
	        	Generator gener = new Generator();
	        	generelem = (Element)generlist.item(i);
	        	//get the generator name
	        	name = generelem.getAttribute("name");
	        	gener.setGeneratorName(name);
	        	//get generator path
	        	nodelist = generelem.getElementsByTagName(GENERATORPATH);
	        	if (nodelist.getLength() == 1)
	        	{
	        		elem = (Element)nodelist.item(0);
	        		path = elem.getFirstChild().getNodeValue();
	        		gener.setGeneratorPath(path);
	        	}	
	        	//nodelist = generelem.getElementsByTagName(INPUTFILE);
	        	//if (nodelist.getLength() == 1)
	        	//{
	        	//	elem = (Element)nodelist.item(0);
	        	//	inputfile = elem.getFirstChild().getNodeValue();
	        	//	gener.setInputfile(inputfile);
	        	//}
	        	//get import file path
	        	nodelist = generelem.getElementsByTagName(IMPORTFILE);
	        	if (nodelist.getLength() == 1)
	        	{
	        		elem = (Element)nodelist.item(0);
	        		if (elem.getFirstChild() !=null)
	        		{
	        			importfile = elem.getFirstChild().getNodeValue();
	        			gener.setImportfilePath(importfile);
	        		}
	        		else
	        			importfile = "";
	        	}
	        	//get export file path
	        	nodelist = generelem.getElementsByTagName(EXPORTFILE);
	        	if (nodelist.getLength() == 1)
	        	{
	        		elem = (Element)nodelist.item(0);
	        		if (elem.getFirstChild() != null)
	        		{
		        		exportfile = elem.getFirstChild().getNodeValue();
		        		gener.setExportfilePath(exportfile);
	        		}
	        		else
	        			exportfile = "default";
	        	}
	        	
	        	elemgrplist = generelem.getElementsByTagName(ATTRIBUTES);
	        	{
	        		if (elemgrplist.getLength() != 1)
	        			throw new RuntimeException("Each generator must have a Attributes node");
	        		elem = (Element)elemgrplist.item(0);
	        		ReadAttrisGrp(elem, gener.getAttrisGrp());
	        		/*
	        		//traverse each attributes group
	        		for (j = 0; j < elemgrplist.getLength(); j++)
	        		{
	        			elem = (Element)elemgrplist.item(j);
	        			attrisgrpname = elem.getAttribute("name");
	        			
	        			//get the import attributes group
	        			if (attrisgrpname.equals(IMPORT))
	        			{
	        				ReadAttrisGrp(elem, gener.getImportAttrisGrp());
	        			}
	        			
	        			//get the export attributes group
	        			if (attrisgrpname.equals(EXPORT))
	        			{
	        				ReadAttrisGrp(elem, gener.getExportAttrisGrp());
	        			}
	        		}
	        		*/
	        	}
	        	
	        	generators.add(gener);
	        }
	        
	        return generators;
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		
		return null;
	}