Java tutorial
//package com.java2s; //License from project: Common Public License import org.w3c.dom.Element; public class Main { /** * */ public static final String DITA_ELEM_TAGNAME = "dita"; public static final String DITA_FORMAT_ATTNAME = "format"; /** * Return true if the linking element specifies a, explcitly or implicitly, a * DITA map or topic document. * @param link An element that may exhibit the format attribute * @return */ public static boolean targetIsADitaFormat(Element link) { if (link.hasAttribute(DITA_FORMAT_ATTNAME)) { String formatValue = link.getAttribute(DITA_FORMAT_ATTNAME); if (!DITA_ELEM_TAGNAME.equalsIgnoreCase(formatValue) && !"ditamap".equalsIgnoreCase(formatValue)) return false; } return true; // default format is "dita" } }