次の方法で共有


Dev Luv: Transforming Visio’s XML File Format

As I mentioned in my last blog on the Visio XML file format, Visio documents can be saved into a native XML Visio file format (.VDX) or Scalable Vector Graphics (SVG). The Visio XML file format is not a W3C standard. SVG, which is a language for describing two-dimensional graphics and graphical applications in XML, is a W3C standard and has a strong community of support. (Click here to read up on SVG.)

 

If you’re looking to convert Visio VDX files to a W3C-accepted standard XML file format, you have two options.

 

1. Use SVG. As a user, you can save any Visio 2003 file to SVG. As a developer, you can automate the saving of a Visio file to SVG format. You can also take advantage of post-authoring third party tools that can convert a Visio XML file to SVG. I hear that SourceForge has a tool that does this, although I have not tried it myself.

2. Write an XSLT to transform the Visio VDX file. You’ll have to write a transform that maps Visio XML to another schema. There is a sample in the Visio 2002 SDK called “XSLT Sample” that describes how to use XSL Transformations (XSLT) to transform data in a Visio drawing into an HTML-based report (you can do a transform for another XML schema too). The sample consists of an HTML page used to run the XSLT and display the resulting report, the Visio drawing in XML (.vdx) format, the XSLT map that transforms document data, the XSLT map that transforms shape data, and the JScript file containing the functions used in the sample. The sample takes a Visio diagram like this one:

You can set if the report displays document and/or shape properties, and get the following report:

Note this sample illustrates how to do a transform from a VDX file to HTML. To run a report on custom properties within Visio, you can go to the Tools Menu, click Reports, and walk through the wizard.

I’ve heard requests from customers to add the ability to save a Visio document to other XML file formats that are industry-specific, like the Business Process Execution Language (BPEL), which is currently in process of being standardized. BPEL is a schema that supports abstract processes as well as the extensive details for executable processes. It deals explicitly with the key elements of a business process, such as control flow and long-running units of work. I think it’s pretty interesting. I also think that other XML schemas out there for industries ranging from biology (Systems Biology Markup Language) to finance (Open Financial Exchange) are interesting. We like standards. If these schemas become standards accepted by the W3C and accepted by the marketplace as the de facto standard, then Visio will certainly look into having the ability to leverage the ones that make sense for our customers, such as standards for business process diagrams.

 

However, we don’t provide native export support for these schemas in Visio 2003 because they are not universally accepted by the W3C or the marketplace and Visio is not specifically a BPEL or SBML or (insert XML flavor here) authoring tool. Visio gets used to create business process flowcharts, network layouts, org charts and a whole number of other types of diagrams. That’s one of the reasons why the Visio app is so popular. Yes, these diagrams MAY end up in an enterprise system that uses a custom XML format, but that's why we provide the tools to enable a transform to industry-specific XML schemas (through an XML file format of our own and documentation.).

 

Visio 2003's export to SVG is pretty powerful functionality. SVG is a widely accepted and used XML schema. If you want to publish your Visio diagrams in a W3C standard format, use SVG. If you want to transform your Visio XML file to a specific XML schema like BPEL, you have a couple approaches you can take. You can write an XSLT to transform the Visio XML to BPEL format. Or, you can use SolutionXML to store and extract the shape information from the Visio XML file and add that data to an existing BPEL file or just write a simpler transform on the shape schema (rather than the entire Visio XML file format).

 

Next blog: How to best store and extract data from a Visio XML file using SolutionXML.  

 

-- Mai-lan

 

This posting is provided "AS IS" with no warranties, and confers no rights

Comments

  • Anonymous
    October 28, 2004
    Are there any example SVG exported Visio files available? I don't currently have a copy, and aren't sure if it really can do the job for me, some example files would really help, any around?
  • Anonymous
    October 31, 2004
    I've posted a Visio file that I exported to SVG to: http://mailan.members.winisp.net/images/CustProp.svg

    Thanks,
    Mai-lan
  • Anonymous
    October 31, 2004
    Mai-Lan,
    can you post the xsl stylesheet used in this example in your blog?

    thnks
  • Anonymous
    November 03, 2004
    The comment has been removed
  • Anonymous
    November 08, 2004
    The comment has been removed
  • Anonymous
    November 09, 2004
    I changed the file extension on it and it should load up in the browser. Try http://mailan.members.winisp.net/images/CustProp.xml

    Thanks for the heads-up,
    Mai-lan
  • Anonymous
    June 19, 2009
    PingBack from http://mydebtconsolidator.info/story.php?id=10307