Java examples for XML:XML Element Value
get XML Tag Value Integer
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static int getTagValueInteger(String sTag, Element eElement) { NodeList nlList = eElement.getElementsByTagName(sTag).item(0) .getChildNodes();/*from w w w . j av a 2 s . co m*/ Node nValue = (Node) nlList.item(0); int value = 0; try { value = Integer.parseInt(nValue.getNodeValue()); } catch (Exception ex1) { System.out .println("Exception at: com.alliancerational.parser.DocUtils(25): " + ex1); } return value; } }