Jumpstart Functionality: Attach an XML Schema in Word 2003
- Why Would You Want To Attach a Schema?
- You Need a Schema To Attach a Schema
- Add a New Schema to the Library
- Attach the XML Schema to Your Document
- Applying the XML Tags
- Saving the XML Document
- Detaching the XML Schema
The first time I heard of XML, someone explained it to me as a language for the web that allowed developers to customize their terms, almost creating a new language as they went. "This is never going to work," I told a colleague, displaying that knowledge of the technological marketplace that has made my fortune what it is today. "If name means a different thing to you than it means to me because we've defined it differently, how can we communicate?"
Oddly enough, other people thought of that issue, too, and fortunately some of them were designers and developers who created XML schemas. An XML schema is an agreed-upon set of terms that structures XML communication. At its heart is the XML schema definition (XSD), a set of rules for describing and validating data in XML.
When you convert a Word 2003 document to XML format by using Word's Save As command, you do so by saving with the default XML schema that Word provides: Word XML. But attaching a different XML schema is easy, and you might have some excellent reasons to do it.
Why Would You Want To Attach a Schema?
One common use for XML schemas in Word is handling documents that are published or updated frequently in the same format or that contain information to be integrated with a database. Perhaps your company routinely publishes a newsletter. The XML schema for that newsletter might contain tags called title, byline, blurb, body, pull-quote, etc. When you apply these tags, they might encode some of the same kind of information that would ordinarily be handled by your Word styles—boldface, font and type size, and so on. Your tags might also contain pricing information that could be updated globally (pushed from a database), or instructions that automatically route the placement of your column to the top of the back cover as the newsletter goes to production. And if the text is presented online, the XML tags might designate how your column is published in web format as well as in print.
Sometimes whole industries attempt to conform to a single XML schema. Such schemas ensure consistency across the marketplace, allowing for easy sharing and manipulating of data. When your documents conform to such a schema—for example, the Health Level 7 (HL7) schema for the healthcare industry or the Real Estate Land Markup Language (RELML) for real estate—you can send documents from your local firm to regional offices or other vendors and be sure that all industry databases will read the information properly.
If the industry is complex and offers many interlocking services, such as in healthcare, this setup can ensure not only the broad coordination of several providers (insurance, hospitals, pharmacists), but vital opportunities for error checking. Consider, for example, the dictation service that writes up a doctor's notes on a patient visit. When the notes are properly tagged, all items called medication can automatically be compared to previously prescribed meds or a patient's listed allergies to flag any potential conflicts.