Here you can find the source of getAttributeContent(Node item, String attributeName)
public static Optional<String> getAttributeContent(Node item, String attributeName)
//package com.java2s; //License from project: Open Source License import java.util.Optional; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { /**/*from w ww .j a v a 2 s . c om*/ * Gets the content of an attribute. * For example, * <item attributeName="content" /> */ public static Optional<String> getAttributeContent(Node item, String attributeName) { NamedNodeMap attributes = item.getAttributes(); return Optional.ofNullable(attributes.getNamedItem(attributeName)).map(Node::getTextContent); } }