How to Fix the End tag/start Tag Error in MS Word

This tutorial explains how to fix the end tag error message in Word.

Here’s the error message:

The name in the end tag of the element must match the element type in the start tag.

This error is related to oMath tags. There are several ways to fix this but let’s look at the symptoms first.

Tag Start Error Symptoms

Does the following error message appear when you open a Microsoft Word 2007, 2010 or 2013 document?

Word 2007/2010:

The file <document filename> cannot be opened because there are problems with the contents.

The Details button says:

The name in the end tag of the element must match the element type in the start tag.

Word 2013:

You receive an “end tag” error when you open a DOCX file in Word 2007, 2010 or 2013

We’re sorry. We can’t open <document filename.docx> because we found a problem with its contents.

The Details button says:

The name in the end tag of the element must match the element type in the start tag.

What causes this end tag error?

It’s to do with oMath tags.

It occurs when a graphical object or text box is anchored to the same paragraph that contains the equation.

How to fix

For new files, use the Office 2013 and Office 2010 Service Pack 1 to fix this issue. See links below.

This stops the problem from recurring with files recovered with the Fix it solution later in this article.

Step 1

Download Office 2010 Service Pack 1. To do this, follow the steps provided in this Microsoft knowledge base article: 2460049 ‐ Description of Office 2010 SP1.

See: http://www.microsoft.com/en-IE/download/details.aspx?id=26622

Step 2

Use the Fix it solution to recover your Word documents.

See: http://go.microsoft.com/?linkid=9770458

How to use Fix it

  1. Click the Fix it link at http://go.microsoft.com/?linkid=9770458
  2. Click Download.
  3. In the File Download dialog box, click Run and then follow the steps.

Fix the XML

If that doesn’t work, or you want to fix the issue yourself, you can examine how the MS Word document is constructed by looking at the underlying XML.

Essentially, the XML is used to structure the document in a certain way. Sometimes, the tags get confused and appear in the wrong order, thus the error.

To fix the Word error, open the XML, correct the tag, and save the file.

Before you start – make a backup of the MS Word file.

Then follow these steps:

  1. Add .zip to the MS Word file name, eg myfile.docx.zip
  2. Open the ZIP file and you’ll see a series of files (document parts).
  3. Select and copy the XML to another place on your PC.
  4. Open it with Notepad and fix the tags.

If you are familiar with editing XML, you can try to fix the problem yourself by correcting the mismatched oMath tags in the document. See the following example:

Note how the tags are out of sequence.

Incorrect tags:

<mc:AlternateContent>

<mc:Choice Requires=”wps”>

<m:oMath>

</mc:AlternateContent>

</m:oMath>

 

Correct tags:

<m:oMath>

<mc:AlternateContent>

<mc:Choice Requires=”wps”>

</mc:AlternateContent>

</m:oMath>

  1. Paste it back to the zip file and REPLACE the old file.

Did this fix the problem?

No? Try one of these workarounds:

Grouping Objects

Word 2010 and Word 2013:

  1. Open the recovered document.
  2. In the Home tab, Selection pane, click the Select dropdown button, then Selection Pane
  3. Press Ctrl on your keyboard and then click each text box in the selection pane.
  4. Click Group under the Format This groups the objects together.
  5. After grouping all the objects, save the document with a new name.
  6. Save the document in the .RTF file format

Word 2007, Word 2010 and Word 2013:

  1. Open the recovered document.
  2. Click File, Save As.
  3. Click Save as type and select Rich Text format ﴾*.rtf﴿.
  4. Click Save.

Rebuild Macro

Another option is to use this macro to fix the ‘end tag of the element must match the element type in the start tag’ error.

  1. Download the macro from http://www.wordarticles.com/temp/Rebuilder.dotm
  2. Copy it to your Startup folder (appdataMicrosoftWordStartup) or (C:Program FilesMicrosoft OfficeOffice14STARTUP)
  3. Start MS Word. It now has an extra tab on the ribbon: Broken Documents.
  4. Click the button on this tab, select your document, and let it process the file.

Don’t touch MS Word while it’s processing. It may take a few minutes.

References

Office 2010 Service Pack 1