ensureOrder();
final int size = openTags.size();
boolean didNonPayloadRepair = false;
for(int i = 0; i < size; i++) {
IMXMLTagData openTag = openTags.get(i);
if(!closeTags.isEmpty()) {
final IMXMLTagData closeTag = closeTags.peek();
if(closeTag.getName().compareTo(openTag.getName()) != 0) {
//let's determine where to end, and then move all of our tags to our parent
int insertOffset = -1;
while(!closeTags.isEmpty()) {
final IMXMLTagData pop = closeTags.pop();
if(pop.getName().compareTo(openTag.getName()) != 0) {
insertOffset = pop.getIndex();
if(parent != null) {
parent.addCloseTag(pop);
} else {
//since the parent cannot handle this, we should insert an open tag for this close tag
FakeMXMLTagData tagData = new FakeMXMLTagData(pop.getName(), false, false);
tagData.setOffsets(pop.getAbsoluteEnd(), pop.getAbsoluteEnd());
tagData.setLine(pop.getLine());
tagData.setColumn(pop.getColumn());
payload.add(new MXMLTagDataPayload(tagData, insertOffset - 1));
problems.add(produceProblemFromToken(tagData, fileSpec));
if(i + 1 < size)
openTag = openTags.get(++i);