List of usage examples for org.jdom2 Element getChildText
public String getChildText(final String cname, final Namespace ns)
From source file:XMLReader.ReadUsersXML.java
License:Open Source License
public static User ReadUser(String usuario, String pass, String xmlSource) { User user = null;//from www. j a va 2 s . co m try { Element rootNode = builder.build(xmlSource).getRootElement(); List<Element> usersList = rootNode.getChildren("user", ns); for (Element e : usersList) { if (e.getChildText("usuario", ns).equals(usuario) && e.getChildText("password", ns).equals(pass)) { user = new User(e, ns); break; } } } catch (IOException io) { System.out.println(io.getMessage()); } catch (JDOMException jdomex) { System.out.println(jdomex.getMessage()); } return user; }