/**
   * Checks to see if the expected elements are present at the start of the actual current elements.
   *
   * @return true if the expected elements can be seen at the start of the actual elements.
   */
  private boolean actualElementStackHasExpectedElements(XMLChunkerState data) {
    Stack<String> actual = data.getElementStack();
    Stack<String> expected = data.getExpectedContainerElementsStack();

    if (actual.size() < expected.size()) {
      return false;
    }

    for (int i = 0; i < expected.size(); i++) {
      if (!actual.get(i).equals(expected.get(i))) {
        return false;
      }
    }

    return true;
  }