@Test public void testIsWithinElement() { Stack<String> parents = new Stack<String>(); parents.add("ref-list"); parents.add("ref"); assertTrue(isWithinElement("name", "name", parents, "ref")); assertFalse(isWithinElement("name", "name", parents, "ref-list")); }
public static boolean isWithinElement(String qName, String expectedElement, Stack<String> parentStack, String expectedParent) { return qName.equals(expectedElement) && (expectedParent==null || !parentStack.isEmpty() && expectedParent.equals(parentStack.peek())); }
TagHierarchyUtils { public static boolean isWithinElement(String qName, String expectedElement, Stack<String> parentStack, String expectedParent) { return qName.equals(expectedElement) && (expectedParent==null || !parentStack.isEmpty() && expectedParent.equals(parentStack.peek())); } }
TagHierarchyUtils { public static boolean isWithinElement(String qName, String expectedElement, Stack<String> parentStack, String expectedParent) { return qName.equals(expectedElement) && (expectedParent==null || !parentStack.isEmpty() && expectedParent.equals(parentStack.peek())); } private  TagHierarchyUtils(); }
TagHierarchyUtils { public static boolean isWithinElement(String qName, String expectedElement, Stack<String> parentStack, String expectedParent) { return qName.equals(expectedElement) && (expectedParent==null || !parentStack.isEmpty() && expectedParent.equals(parentStack.peek())); } private  TagHierarchyUtils(); static boolean isElement(String qName, String expectedElement); static boolean isWithinElement(String qName,
            String expectedElement, Stack<String> parentStack, String expectedParent); static boolean hasAmongParents(String qName,
            String expectedElement, Stack<String> parentStack, String... expectedParents); static boolean hasAmongParents(Stack<String> parentStack, String... expectedParents); }
TagHierarchyUtils { public static boolean isWithinElement(String qName, String expectedElement, Stack<String> parentStack, String expectedParent) { return qName.equals(expectedElement) && (expectedParent==null || !parentStack.isEmpty() && expectedParent.equals(parentStack.peek())); } private  TagHierarchyUtils(); static boolean isElement(String qName, String expectedElement); static boolean isWithinElement(String qName,
            String expectedElement, Stack<String> parentStack, String expectedParent); static boolean hasAmongParents(String qName,
            String expectedElement, Stack<String> parentStack, String... expectedParents); static boolean hasAmongParents(Stack<String> parentStack, String... expectedParents);  }