Preparing and Using XML Documents


XML (Extensible Markup Language) is a relatively new data standard that allows for the easy exchange of data across formats. You may hear it called a markup language , similar to HTML, because that s what its name implies. But XML is more than a language of tags; XML actually allows users to create their own markup languages specific to their data needs, based on a collection of set standards.

With XML, you use specific rules to create your own tags and style sheets; the individual tags describe the content and meaning of the data rather than the display format of the data (which is what HTML controls). XML is ordinarily logical and pretty easy to read, which makes it easy ”even for users unfamiliar with XML ”to see what s going on in an XML data file. All these possibilities and more make working with XML in Word a simple but powerful feature for changing the way data is prepared, used, shared, and saved for the future.

Note  

Different levels of XML support are available in different versions of Office System. If you are using Professional Enterprise or Professional Editions, you have full XML support and can attach schemas, use transforms, and more. If you have the Standard or Basic Editions of Office System, you can save documents in XML format but do not have access to the higher-end XML features.

Introduction to XML in Word

The new XML features in Word 2003 enable you to view, work with, and save XML files easily. Here s the process in a nutshell :

  1. Attach an XML schema using the XML Structure task pane.

    Lingo  

    An XML Schema is document that defines the elements, entities, and content allowed in the document.

  2. Identify the data by adding XML tags. You can tag document information to identify its content (such as <HEADING>, <BODYTEXT>, or <GRAPHIC>). You use tag view to add tags to your data easily.

  3. Save the document as XML. Word gives you the option of saving the document as data only or applying a transform (format specification for the data).

    Lingo  

    XSL Transforms save the document in different forms for different views and are available whenever a Word file is opened and/or saved.

Attaching an XML Schema

The first step in working with XML in your document is attaching the XML schema, the file that defines and describes the tags used and recognized in your XML document. To attach a schema, display the XML Structure task pane (click the down arrow in the task pane title bar), and click the Templates And Add-Ins link in the XML Structure task pane (see Figure 6-4). Click the Add Schema button to display a dialog box in which you can select the schema you want to attach to your document.

start sidebar
Aha! ”Where Do You Get a Schema?

In some circumstances, you will be applying a schema others have created to go along with your data. In other cases, you may be creating a schema yourself for a specific use. Industry-standard schemas are now being developed to allow for common data exchange among various industry areas.

click to expand
Figure 6-4: You can select and add a schema to your current document in the XML Schema tab of the Templates And Add-Ins dialog box.
Note  

You can add more than one schema to a single document if you like. Word will apply both sets of definitions and rules, and alert you if there is a conflict.

end sidebar
 

After you attach a schema and click OK, Word evaluates the incoming schema to see whether it s properly formed . If there are errors in the code, Word will alert you and stop the attachment until the code is corrected.

Adding XML Tags

You use the XML task pane to view the structure of your XML document so that you can navigate easily through the document and add XML tags as needed. By using the features in this task pane, you can easily add XML tags in your document while you work (see Figure 6-5). Word checks tags against the applied schema to make sure that you are entering tags the XML schema will recognize.

click to expand
Figure 6-5: The task pane displays the tree structure of the current XML document and enables you to click and add tags while you work.
Note  

You can turn tag view off and on by clicking the Show XML tags in the document check box in the task pane.

Saving the XML Document

When you open an XML file in Word and choose XML files from the Files Of Type list in the Open dialog box, you also have the option of applying an XSL Transform as you open the file. Display the shortcut menu by clicking the small arrow to the right of the Open tool to find the Open With Transform option.

Lingo  

An XSL Transform allows you to display an XML document in different views; for example, perhaps you are opening a report file that you also want to display on the Web. Applying a Transform allows you to see the file in a Web-based format without making modifications to the file itself.

When you choose XML Document in the Save As Type field of the Save As dialog box, two XML-specific options appear to the left of the Save button. You can click the Apply Transform check box to enable the Transform button; then click that button to choose the transform you want to apply.




Faster Smarter Microsoft Office System
Faster Smarter Microsoft Office System -- 2003 Edition
ISBN: 0735619212
EAN: 2147483647
Year: 2003
Pages: 238

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net