Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean userExists(String username){
- //System.out.println("achi1hth");
- try{
- File fXmlFile = new File(filePath);
- DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
- System.out.println("hfjhf");
- Document doc = dBuilder.parse(fXmlFile);
- System.out.println("fdg");
- doc.getDocumentElement().normalize();
- //System.out.println("achi");
- NodeList nList = doc.getElementsByTagName("user");
- for (int temp = 0; temp < nList.getLength(); temp++) {
- Node nNode = nList.item(temp);
- if (nNode.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) nNode;
- if(getTagValue("username", eElement).equals(username)){
- return true;
- }
- }
- }
- return false;
- }
- catch(Exception ex){
- System.out.println("Database exception : userExists()");
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement