void () { final PsiBuilder.Marker document = mark(); while (isCommentToken(token())) { parseComment(); } parseProlog(); int rootTagCount = 0; PsiBuilder.Marker error = null; while (!eof()) { final IElementType tt = token(); if (tt == XML_START_TAG_START) { error = flushError(error); rootTagCount++; parseTag(rootTagCount > 1); } else if (isCommentToken(tt)) { error = flushError(error); parseComment(); } else if (tt == XML_PI_START) { error = flushError(error); parseProcessingInstruction(); } else if (tt == XML_REAL_WHITE_SPACE) { error = flushError(error); advance(); } else { if (error == null) error = mark(); advance(); } } if (error != null) { error.error(XmlPsiBundle.message("xml.parsing.top.level.element.is.not.completed")); } if (rootTagCount == 0) { final PsiBuilder.Marker rootTag = mark(); error = mark(); error.error(XmlPsiBundle.message("xml.parsing.absent.root.tag")); rootTag.done(XML_TAG); } document.done(XML_DOCUMENT); }