Troubleshooting

What to Do If Word Can't Open My XML File

graphics/trouble_icon.jpg

Several different problems can prevent Word from opening an XML file:

  • An XML file must be well formed for Word to open it. If you see a message indicating that this situation exists, open the file in Notepad, fix the problem, and then try opening the file again.

    TIP

    If you have problems finding the specific location of an XML syntax error, try opening the file in Internet Explorer. It will attempt to validate the structure and provide more specific information about where the problem is.


  • If you have created a document that does not have any XML structure elements in it and then choose to save data only, nothing will be saved. This is because the document text has no root node, and therefore a properly formed XML document cannot be created. When you try to open the file backup, it will be empty. If the content of your document does not contain valid XML, don't use the Save Data Only option.

  • If you have specified an XSLT transformation and Word cannot use it, Word will try to apply any other transformation that is included in the document. If no others are available, Word will then try a default transformation to open the document. If all of these attempts fail, Word gives you a message indicating the problem. You must either use a different transformation file or open the XML file in Notepad and fix the source of the problem.

What to Do If the XML Document Task Pane Disappears

If you have selected a data view in the XML Document task pane and then open that file for editing, the data view is automatically activated. Because the data view is an XSLT transformation, you cannot reverse the process that results in removal of the XML Document task pane. To avoid this situation, make sure that you select the desired data view before you start editing.

What to Do If Inserting XML from Another File Doesn't Work

When using an XPATH expression to select data from another XML file, Word does not validate the syntax of the expression. If you enter an expression that is invalid or does not match anything in the XML file, nothing will be inserted and no error messages will be displayed. Keep these things in mind when using XPATH queries:

  • Querying XML structures is a case-sensitive operation. Make sure you are specifying your element or attribute names with the correct case.

  • If the XML file you are selecting data from was saved using Word's default WordML schema, your XPATH query must address that XML structure before it will work.

What to Do If a Data View or Transformation Does Not Find Any Data

Querying XML structures via XPATH or XSLT is not always a simple operation. If you enter an expression that is invalid or does not match anything in the XML file, nothing will be displayed and no error messages will be displayed. Keep these things in mind when working with data views and transformations:

  • Querying XML structures is a case-sensitive operation. Make sure you are specifying your element or attribute names with the correct case.

  • If the XML file you are selecting data from was saved using Word's default WordML schema, your XPATH query must address that XML structure before it will work.

What to Do If You Lose Data After Saving Your XML File

If you save a file using an XSLT transformation, Word saves only the result of the transformation. The original data file is not saved. To prevent loss of data when using these transformations, keep a separate copy of the source XML file. Be sure to use the Save As menu when you apply your transformation.

What to Do If the List of Elements Is Hard to Read

Sometimes you may find that the element names in the XML Structure task pane have long strings on the end that start with {urn:,. This string is the namespace that the element belongs to. Although this is useful when multiple namespaces are used in the same document, it can also make the element names hard to read. You can turn off the display of the namespace by clicking on the XML Options, and then selecting the Hide Namespace Alias in XML Structure Task Pane check box.

What to Do If No Elements Are Available to Add When Editing an XML Document

Word requires access to a valid XML schema before it will allow any changes to be made to the structure itself. Make sure that the required schema has been added to the Schema Library.



    Part I: Word Basics: Get Productive Fast
    Part II: Building Slicker Documents Faster
    Part III: The Visual Word: Making Documents Look Great
    Part IV: Industrial-Strength Document Production Techniques
    Part VI: The Corporate Word