@Test public void testHasAmongParents() { Stack<String> parents = new Stack<String>(); parents.add("ref-list"); parents.add("ref"); parents.add("something"); parents.add("name"); assertTrue( hasAmongParents("surname", "surname", parents, "name", "something", "ref", "ref-list")); assertTrue(hasAmongParents("surname", "surname", parents, "name", "ref", "ref-list")); assertTrue(hasAmongParents("surname", "surname", parents, "name", "ref")); assertTrue(hasAmongParents("name", "name", parents, "name")); assertTrue(hasAmongParents("name", "name", parents, "ref")); assertTrue(hasAmongParents("name", "name", parents, "ref-list")); assertFalse(hasAmongParents("surname", "surname", parents, "ref", "name")); assertFalse(hasAmongParents("surname", "surname", parents, "ref-list", "ref")); assertFalse(hasAmongParents("name", "name", parents, "xxx")); }
public static boolean hasAmongParents(String qName, String expectedElement, Stack<String> parentStack, String... expectedParents) { if (qName.equals(expectedElement)) { return hasAmongParents(parentStack, expectedParents); } else { return false; } }
TagHierarchyUtils { public static boolean hasAmongParents(String qName, String expectedElement, Stack<String> parentStack, String... expectedParents) { if (qName.equals(expectedElement)) { return hasAmongParents(parentStack, expectedParents); } else { return false; } } }
TagHierarchyUtils { public static boolean hasAmongParents(String qName, String expectedElement, Stack<String> parentStack, String... expectedParents) { if (qName.equals(expectedElement)) { return hasAmongParents(parentStack, expectedParents); } else { return false; } } private  TagHierarchyUtils(); }
TagHierarchyUtils { public static boolean hasAmongParents(String qName, String expectedElement, Stack<String> parentStack, String... expectedParents) { if (qName.equals(expectedElement)) { return hasAmongParents(parentStack, expectedParents); } else { return false; } } 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 hasAmongParents(String qName, String expectedElement, Stack<String> parentStack, String... expectedParents) { if (qName.equals(expectedElement)) { return hasAmongParents(parentStack, expectedParents); } else { return false; } } 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);  }