• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

4.1. Clarifying Use Cases

There are two broad use cases for Word's custom XML schema functionality, the first of which is the focus of this chapter:

  • Using Word to edit custom XML documents that conform to your schema

  • Using custom tags to add richer meaning to Word documents

In many respects, the first use case—using Word as an XML editor—is the most exciting. As XML's role in software engineering grows, one of the most difficult problems continues to be getting end users to create XML documents for all our wonderful back-end systems to process. Word is so familiar and its usage so pervasive that XML editing solutions based on it could take huge steps toward solving this problem. Unfortunately, the extent of Word's built-in custom XML schema functionality leaves a lot to be desired, at least in comparison to other XML editing products on the market. That doesn't mean you won't be able to create fully functional and powerful solutions based on Word, but it does mean you will need to do more actual programming than you might have otherwise expected. Word's base XML schema functionality supports simple business-template use cases (such as memos, purchase orders, and resumes), where the choice of elements used is fixed, there are no optional elements, etc. To handle richer structures such as those found in any document-oriented XML, at least in a user-friendly way, you will need to incorporate Smart Document programming, as described in Chapter 5.

With the exception of support for mixed content, the InfoPath application provides much of the built-in, schema-driven, and user-friendly structural editing support one might have expected in Word. For more information, see Chapter 10.


The second use case—annotating Word documents with metadata—is essentially another flavor of the business-template scenario. The distinction is that whereas in the first case Word is merely the editor of your underlying data (and in principle could be replaced by any other editor), here you are interested in keeping Word documents around as such, complete with their rich, Word-specific formatting. The XML tags might be used for better document retrieval, or another process might glean the XML data out of the document and into a database, but either way your information is firmly tied to the Word document in which it resides (whether stored as a .doc file or as WordprocessingML). Any embedded XML data is supplementary and does not provide the whole story.

This chapter will present the basic components of Word's core XML schema functionality, including related document options and how they are represented in WordprocessingML. We will see how schema attachment, onload and onsave XSLT stylesheets, placeholder text, and document protection can work together to make a working XML editing solution for Word, according to the first use case mentioned above (using Word as an XML editor).

While this chapter can be seen as a preparation for learning Smart Documents (in Chapter 5), it stands alone in its own right. By the time you are done reading it, you will have traversed a complete XML editing solution in Word—what it is, how it works, and how it was developed. We will push the limits of what can be done with XSLT and Word's base XML functionality to see how far they can take us without venturing into Smart Document programming.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint