Here you can find the source of getAttributeValue(Node node, String name, boolean defaultValue)
public static boolean getAttributeValue(Node node, String name, boolean defaultValue)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 GoPivotal, Inc./*from w ww . ja v a2s.c o m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * GoPivotal, Inc. - initial API and implementation *******************************************************************************/ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String getAttributeValue(Node node, String attribName) { NamedNodeMap attribs = node.getAttributes(); if (attribs != null) { Node value = attribs.getNamedItem(attribName); if (value != null) { short nodeType = value.getNodeType(); if (nodeType == Node.ATTRIBUTE_NODE) { return value.getNodeValue(); } } } return null; } public static boolean getAttributeValue(Node node, String name, boolean defaultValue) { String str = getAttributeValue(node, name); if (str == null) { return defaultValue; } else { return "true".equals(str); } } }