Java tutorial
//package com.java2s; //License from project: Common Public License import org.w3c.dom.Element; public class Main { public static final String DITA_CLASS_ATTNAME = "class"; public static final String DITA_TOPICTITLE_TYPE = "topic/title"; /** * Returns true if the element of type DITA_TOPICTITLE_TYPE * @param child * @return True if it's a topic titlel */ private static boolean isTopicTitle(Element elem) { return isDitaType(elem, DITA_TOPICTITLE_TYPE); } public static boolean isDitaType(Element element, String ditaMapType) { String classValue = element.getAttribute(DITA_CLASS_ATTNAME); if (classValue != null) { return (classValue.indexOf(" " + ditaMapType.trim() + " ") > 0 || classValue.endsWith(" " + ditaMapType.trim())); } return false; } }