code: protected boolean elements(String... name) {
          if (name == null || name.length != stack.size()) {
              return false;
          }
          for (int i = 0; i < name.length; i++) {
              if (!name[i].equals(stack.get(i))) {
                  return false;
              }
          }
          return true;
      }
docs: Checks whether the element stack currently contains exactly the elements supplied by the caller. This method can be used
  to find the current position in the document. The first argument is always the root element of the document, the second
  is a child of the root element, and so on. The method uses the local names of the elements only. Namespaces are ignored.
  
  @param name The names of the parent elements
  @return <code>true</code> if the parent element stack contains exactly these elements