Page 26 of 29PREVNEXT

Open XML II: Editing Documents in the XML

Elements of a single comment reference that appear in a document.XML file

The highlighted portions of the XML shown here are elements of a single comment reference that appear in a document.xml file. If you delete comments.xml from a Word document ZIP package, you must delete all such references from document.xml.

As noted earlier in this lesson, most document parts include content that is referenced in other document parts. For example, comments, headers, footers, or footnotes all have their own document parts. However, when used in a Word document, references to those types of content also appear in document.xml.

In most cases, you must remove any references to the content of a deleted document part from any other document parts in the ZIP package.

As you see in the example, a reference to content from another document part, such as for a comment, can contain several parts. When deleting a comment reference from document.xml, you must delete all parts of that reference to avoid errors when opening the document.

The following are exceptions where you are not required to remove a reference to a deleted document part:

  • Occasionally, you can leave references to the content of a deleted document part without incurring an error. For example, if you delete styles.xml and its relationship definition from a Word document ZIP package, you do not need to remove references to custom styles from document.xml. If a referenced custom style is not stored in a document's ZIP package, any text that references the style reverts to Normal style when the document is opened in Word.
  • You are never required to remove the Override PartName definition that appears in [Content_Types].xml.

Learn how to remove comment references from document.xml in the practice session that follows.

Page 26 of 29PREVNEXT