*/
public boolean isDocumentValid(final String document)
{
HtmlDocumentParser parser = new HtmlDocumentParser(document);
Iterator expectedElements = elements.iterator();
ArrayListStack iteratorStack = new ArrayListStack();
ArrayListStack tagNameStack = new ArrayListStack();
boolean end = false;
boolean valid = true;
while (!end)
{