Schema Library [Word 2003 XML Reference] --  Microsoft Office Word 2003 XML Software Development Kit

Schema Library [Word 2003 XML Reference]

About the Schema Library

The Schema Library helps automate procedures related to editing Extensible Markup Language (XML) documents. Using XML schemas and other files in the Schema Library, combined with information in the XML document being edited, Microsoft® Office Word 2003 provides you with information about the document that makes it easy to work with XML in Word.

Understanding schemas

An XML Schema (.xsd file) defines the structure, content, and semantics of an XML document. It's like a blueprint that determines the kind of data that is allowed in the XML document, as well as the structure of the data. For example, a schema that defines how names and addresses are stored might specify that a "name" element consists of two elements: "firstname" and "lastname."

The schemas you add to the Schema Library may be developed by your company or a third party to meet a particular business need. Many vendors and XML developers create XML schemas that are specifically designed to handle data for a given industry or field, such as business, publishing, finance, education, communications, and more.

Understanding namespaces

When you add a schema to the Schema Library, you establish a namespace for any document that the schema is attached to. The namespace provides a unique identifier for all of the elements that are defined by the schema. This identifier is especially important, for example, if a custom schema happens to define an element name that matches an element name in the Word XML schema (WordProcessingML). The elements do not conflict because each element can be qualified by a prefix that identifies the element's namespace.

A namespace can also function as a way of associating other auxiliary files with a document, such as one or more Extensible Stylesheet Language Transformation (XSLT) files.

Using the Schema Library

The Schema Library provides a way to specify the namespaces that are available, as well as to configure options such as friendly names (aliases) for schemas and any XSLT files that are associated with a schema.

Schemas in the Schema Library are available to attach to a document and are listed on the XML Schema tab of the Templates and Add-ins dialog box (see Figure 1). When you attach an XML schema to a document, the document becomes associated with the same namespace as the schema and with any auxiliary files that are also associated with the same namespace.

Note  When there is more than one schema attached to a document, the document is associated with the namespace of the root element in the document. The root element is the single element in which all other elements in the document reside, according to the rules of standard XML hierarchy.

Figure 1. The XML Schema tab of the Templates and Add-ins dialog box.

Adding or removing XML schemas in the Schema Library

To add a schema to the Schema Library:

  1. On the Tools menu, click Templates and Add-Ins, and then click the XML Schema tab.

  2. Click Add Schema, browse to the XML schema you want to add to the Schema Library, and then click Open.

  3. In the Schema Settings dialog box, select the options you want, and type a name for the schema in the Alias box.

    Note  The name you type for the alias appears in the list of available schemas in the Templates and Add-ins dialog box.

  4. Click OK.

To remove a schema from the Schema Library:

  1. On the Tools menu, click Templates and Add-Ins, and then click the XML Schema tab.
  2. Click Schema Library (see Figure 2).
  3. In the Select a schema box, click the XML schema you want to remove, and then click Delete Schema.

Figure 2. The Schema Library dialog box.

©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