Here you can find the source of getDivHeadAttr(Element annotU, String attrName)
public static String getDivHeadAttr(Element annotU, String attrName)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static String getDivHeadAttr(Element annotU, String attrName) { String a = annotU.getAttribute(attrName); if (a == null || a.isEmpty()) return getHeadAttr(annotU, attrName); return a; }/*from w ww .ja va2s .c om*/ public static String getHeadAttr(Element annotU, String attrName) { NodeList nl = annotU.getElementsByTagName("head"); if (nl == null) return ""; Element head = (Element) nl.item(0); if (head == null) return ""; NodeList notes = head.getElementsByTagName("note"); for (int i = 0; i < notes.getLength(); i++) { Element e = (Element) (notes.item(i)); String a = e.getAttribute("type"); if (a.equals(attrName)) return e.getTextContent(); } return ""; } }