private NodeList parseXml(String fileName)
	{
		//check if xml file exists
		FileInputStream fstream = null;
		try{
			// Open the xml file
			fstream = new FileInputStream(fileName);
		}catch (Exception e){//Catch exception if any
			errorFlag = 1;
			errorString = "Config file could not be loaded.";
			return null;
		}finally
		{
			try
			{
				if(fstream != null)
					fstream.close();
			}
			catch (IOException e)
			{
			}
		}

		File xmlFile = new File(fileName);

		try {
			// Create a new factory to create parsers
			DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
			// Use the factory to create a parser (builder) and use it to parse the document.
			DocumentBuilder builder = dBF.newDocumentBuilder();

			Document doc = builder.parse(xmlFile);
			NodeList list = doc.getElementsByTagName("*");
			return list;
		}
		catch (Exception e) {
			errorFlag = 1;
			errorString = "Config file is not well-formed.";
			return null;
		}
	}