Visio and XML file formats

Applies to
Microsoft Office Visio® 2003
Inside Out Visio 2003 Image This article was excerpted from Microsoft® Office Visio® 2003 Inside Out by Mark H. Walker and Nanette Eaton, Chapter 21, "Customizing Shapes and Solutions." Visit Microsoft Learning to buy this book.

Since the 2002 edition, Visio has supported Extensible Markup Language (XML) file formats. XML goes beyond HTML in describing file content and has quickly become a new standard for Web-based data. In Visio, the .vdx (drawing file), .vsx (stencil file), and .vtx (template file) extensions are the XML equivalents of .vsd, .vss, and .vst. You can export and import Visio files in XML format by using the standard Save As and Open commands on the File menu, as Figure 1 shows. In the Save As or Open dialog box, choose the appropriate XML format in the Save as type or Files of type list.

Save as type list

Figure 1. In the Save As dialog box, the XML file formats appear in the Save as type list.

For most users, the XML interface is not particularly useful. "They'd best avoid it," is how a senior Visio programmer put it. Saving a drawing file in XML format expands the file size approximately eight times. So why is it there? XML is useful to organizations that want to incorporate the contents of Visio files into enterprise systems that exchange information in this format. For example, you can create a Visio flowchart that shows a business process, export the flowchart in XML format, and then share it with other businesses using the Microsoft BizTalk Server. You can save drawings as well as customized stencils or templates in XML format.

Opening XML files

When a Visio file is saved in XML format, you can open it in Visio and work with it in all the ways you can work with standard Visio drawing, stencil, and template files. Visio can open any file that contains well-formed XML code that complies with the Visio XML Schema and the internal rules for Visio. You can also open the XML files that Visio creates in a text or code editor. Visio includes a tag for just about every Visio attribute, from line jump behavior to color definitions. If you're familiar with XML tags and Visio commands, you can easily recognize most of the tags that Visio creates.

 Tip   Microsoft plans to document the XML interface in Visio, but the documentation was not available at the time this book was being written.

Making XML the default file format

You can make XML the default Visio drawing format. To do this, choose Tools, Options, and then click the Save tab, as Figure 2 shows. Select Visio XML document from the Save Visio files as list on the Save tab. In the same dialog box, you can specify whether you want Visio to display warnings and error messages when it opens XML files that contain information it cannot recognize or when it saves XML files that contain data other programs might not be able to read.

Save tab, Options dialog box

Figure 2. You can specify XML as the default file format for Visio documents by choosing Tools, Options.

 Tip   If you want to use a Visio diagram as a Web page, it's better to save it as an HTML file than an XML file. If you post a Visio page in XML format on a Web site, visitors to the site can view the XML file only if they have Microsoft Visio 2002 or Visio 2003 installed on their systems. In addition, if they can see the file, they can also edit it. You can offer viewers a large amount of data through the HTML file without risking the integrity of your drawing.

 
 
Applies to:
Visio 2003