Here you can find the source of getAttributeOrNull(String attribute, Element element)
public static Node getAttributeOrNull(String attribute, Element element)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.*; public class Main { public static Node getAttributeOrNull(String attribute, Element element) { if (!element.hasAttributes()) { return null; }// w w w. j ava 2s . com NamedNodeMap attributes = element.getAttributes(); return attributes.getNamedItem(attribute); } }