Here you can find the source of getIntAttribute(Node node, String attributeName, int defaultValue)
public static int getIntAttribute(Node node, String attributeName, int defaultValue)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; public class Main { public static int getIntAttribute(Node node, String attributeName, int defaultValue) { String value = getAttribute(node, attributeName); if (value == null) { return defaultValue; }// w w w . ja v a2 s . c o m return Integer.parseInt(value); } public static int getIntAttribute(Node node, String attributeName) { return getIntAttribute(node, attributeName, 0); } public static String getAttribute(Node node, String attributeName) { Node n = node.getAttributes().getNamedItem(attributeName); if (n != null) { return n.getNodeValue(); } else { return null; } } }