Export (0) Print
Expand All

Validating an XML Document [Word 2003 XML Reference] --  Microsoft Office Word 2003 XML Software Development Kit

Office 2003

Validating an XML Document [Word 2003 XML Reference]

Important  The information set out in this topic is presented exclusively for the benefit and use of individuals and organizations outside the United States and its territories or whose products were distributed by Microsoft before January 2010, when Microsoft removed an implementation of particular functionality related to custom XML from Word. This information may not be read or used by individuals or organizations in the United States or its territories whose products were licensed by Microsoft after January 10, 2010; those products will not behave the same as products licensed before that date or licenses for use outside the United States.

validating XML

By default, Microsoft Word validates an Extensible Markup Language (XML) document according to the rules of an XML schema whenever a schema is attached to the document. Schema violations are shown in the XML Structure task pane.

Note  An attached schema must be present on the user's machine for XML validation to occur.

To manually enable or disable schema validation for any document:

  1. On the Tools menu, click Templates and Add-Ins.
  2. On the XML Schema tab, do the following:
    • To enforce validation, select the Validate document against attached schemas check box.
    • To disable validation, uncheck the Validate document against attached schemas check box.

To prevent users from saving a document that contains invalid XML markup as an XML file:

  1. On the Tools menu, click Templates and Add-Ins.
  2. On the XML Schema tab, do the following:
    • To prevent Office Word 2003 from saving XML that contains arbitrary XML markup that is not valid, clear the Allow saving as XML even if not valid check box.

      Note  Clearing Allow saving as XML even if not valid prevents the file from being saved in the .doc format.

To help avoid validation errors while you apply XML tags, select the List only child elements of current element check box in the XML Structure task pane. This shows you only those elements defined as children of the current parent element of your selection within the document. Only elements that may be valid in the selected area are shown. Information from the schema such as an element's minimum or maximum number of occurences does not affect what is listed.

Note  You can use the XML Structure task pane to determine the validity of a document while working on it by viewing the icons next to each element.

Note  By default, schema violations are marked in the body of the document with purple wavy lines. To turn this feature off, click XML Options on the XML Schema tab of the Templates and Add-ins dialog box and then select the Hide schema violations in this document check box.

More Information

For more information on the option settings used to configure the XML features in Word, see Understanding XML Options. For suggestions on troubleshooting problems that may occur while using these features, see Troubleshooting XML Documents in Word.

For additional information and examples that describe or demonstrate the end-to-end process of working with XML documents in Microsoft Office Word 2003, please see the following articles in the Microsoft Developer Network (MSDN) Library.

Editing XML Data with Microsoft Office Word 2003 and Microsoft Office Excel 2003
Creating and Applying an XML Resume Template in Microsoft Office Word 2003
Microsoft Office Word 2003 XML: Memo Styles Sample
XML and Microsoft Office Word 2003: Writing a Trip Report


©2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp
Show:
© 2014 Microsoft