Share via


Overview of WordprocessingML [Word 2003 XML Reference] --  Microsoft Office Word 2003 XML Software Development Kit

Overview of WordprocessingML [Word 2003 XML Reference]

Top-Level Elements, Namespace, Basic Document Structure

The top-level elements in a WordprocessingML document are:

However, the simplest WordprocessingML document consists of just five elements (and a single namespace). The five elements are:

The namespace for the root WordprocessingML Schema (also known as the XML Document 2003 Schema) is "http://schemas.microsoft.com/office/word/2003/wordml". This namespace is normally associated with the WordprocessingML elements by using a prefix of "w." The simplest possible WordprocessingML document looks as follows:

<?xml version="1.0"?>
<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
    <w:body>
        <w:p>
            <w:r>
                <w:t>Hello, World.</w:t>
            </w:r>
        </w:p>
    </w:body>
</w:wordDocument>

The following figure shows the resulting document, displayed in Microsoft Office Word 2003.

Tying the Document to Microsoft Office Word 2003

If you save a Microsoft© Office Word 2003 document with the .xml extension, Windows treats the file like any other XML file. When the user double-clicks the file, for example, opens it in the standard XML processor (such as Microsoft Internet Explorer). However, adding the mso-application processing instruction specifies Word as the preferred application for processing the file. As a result, Word opens the XML document when the user double-clicks the document's icon. The following example shows the sample document with the mso-application element added:

<?xml version="1.0"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument 
    xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
<w:body>
    <w:p>
        <w:r>
            <w:t>Hello, World.</w:t>
        </w:r>
    </w:p>
</w:body>

</w:wordDocument>

This topic is intended to serve as a brief introduction to WordprocessingML. For a complete overview, see "Overview of WordprocessingML" included in the Office 2003 XML Reference Schemas.

©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