Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void parse() throws Exception {
- builder = factory.newDocumentBuilder();
- Document doc = builder.parse(new File("player-name.xml"));
- doc.getDocumentElement().normalize();
- NodeList detailList = doc.getElementsByTagName("player");
- for(int i = 0; i < detailList.getLength(); i++) {
- Element detailElement = (Element) detailList.item(i);
- user = detailElement.getAttribute("user");
- pass = detailElement.getAttribute("pass");
- NodeList posList = doc.getElementsByTagName("position");
- Element posElement = (Element) posList.item(0);
- x = Integer.parseInt(posElement.getAttribute("x"));
- y = Integer.parseInt(posElement.getAttribute("y"));
- z = Integer.parseInt(posElement.getAttribute("z"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement