How to use Visio as flowchart UI for export to XML

nebb-alx
nebb-alx used Ask the Experts™
on
I am creating an application where the user shall be able to to create workflows that will execute. I would like to use Visio as the GUI for building these flows.

I need simple start, end, condition and action symbols and export routines.

I would like to be able to import shapes available to each particular situation as various scenarios may not have all types of conditions/actions available.

Could you please guide me on how to:
 - develop my flowchart template with
 - check diagram functionality
 - export to xml functionality

I would like the result exported to XML or somehow follow the defined process. Below is a sample XML that illustrates what I need exported. Typically my application will be evaluating this XML and executing the flow.

I am currently testing Visio 2010. How is it suitable to my requirements?
<myflow>
	<step id="0" type="start">
		<text>Start</text>
	</step>
	<step id="1" type="condition">
		<text>Do you own a car?</text>
		<choice id="1">Yes</choice>
		<choice id="2">No</choice>
	</step>
	<step id="2" type="condition">
		<text>Do you want to buy car insurance?</text>
		<choice id="1">Yes</choice>
		<choice id="2">No</choice>
	</step>	
	<step id="3" type="action">
		<text>Sell car insurance!</text>
		<do>Start car insurance app...</do>
	</step>
	<step id="4" type="stop">
		<text>Stop</text>
	</step>
	<connection id="1">
		<from>0</from>
		<to>1</to>
	</connection>
	<connection id="2">
		<from>1</from>
		<choice>1</choice>
		<to>2</to>
	</connection>
	<connection id="3">
		<from>1</from>
		<choice>2</choice>
		<to>4</to>
	</connection>	
	<connection id="4">
		<from>2</from>
		<choice>1</choice>
		<to>3</to>
	</connection>
		<connection id="5">
		<from>2</from>
		<choice>2</choice>
		<to>4</to>
	</connection>
	<connection id="6">
		<from>3</from>
		<to>4</to>
	</connection>
</myflow>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I saw that one too. Very old and not too helpful am I afraid.
I know I may be engaging in a big project here, but I would like to avoid creating my own interface for workflow editing when Visio seems made for it.
Visio Consultant, Trainer, Author, and Developer
Most Valuable Expert 2011
Commented:
The good news is that what you're asking about is very doable. However, as you've already suggested, it is a big project.

The other good news is that Visio 2010 is much better suited for some of what you want than any of the older versions.

A few specific comments and suggestions:
  • In general, Visio shapes can be automated very easily so your code can validate things like: what can be connected to what, how many connections are legal for a specific shape, etc. I'm working on a project at the moment that uses Visio 2007 and walks the diagram created by a user in order to guide users toward building "correct" diagrams. It utilizes a set of shapes that my client selected. I added some intelligence to the shapes themselves but also wrote the code to validate the drawing. While it has always been possible to do this sort of thing with Visio, Visio 2010 makes it significantly easier because it introduces the notion of "connectedness". You'd think this would have been in Visio since the beginning but it hasn't been. Prior to Visio 2010, your code had to "walk" the diagram to determine what was connected to what. The Visio 2010 APIs make it as easy asking "what am I connected to" or "what is connected to me"?

  • Visio 2010 also introduces "business rules", many of which are a direct outgrowth of "connectedness". You can use the built-in rules or define your own to have Visio validate what is OK and what's not. Relevant blog posts from the Visio development team:
  • Visio MVP David Parker is working on a book on business rules. I don't know the intended publication date but his blog contains two articles on the subject:
  • There are two easy ways to generate XML from Visio. One is to save the drawing itself in Visio XML format. The article plusone3055 referred you to above describes this approach. One downside of this approach is that the XML files tend to be very large for any given drawing; your code is left to parse an enormous quantity of XML junk you don't need. The second option is to use Visio's report wizard to extract the data you want. One of the report wizard's four output formats is XML. The advantage of this approach is that the resulting XML file is much smaller, and while the XML it produces is semantically weak, it is syntactically correct and parseable. (There is a third option, of course -- you can write your own XML output. While a bit more work, you obviously end up with exactly what you need.)
Special note: Visio 2007 and earlier were sold in two "editions": Standard and Professional. Visio 2010 will be offered in three editions: Standard, Professional and Premium. The "connectedness" APIs will be in all three editions but the business rules functions will only be available in Premium.

Please refer to my EE profile for additional information about workflow/process mapping with Visio.

Author

Commented:
Scott,

Thank you for your elaborate answer. I am now confident Visio is the right choice for this purpose. We will evaluate this soon to see how much work it is to integrate it into our solution.  Might start with 2010 support only.

Thanks again!

Alex.
Scott HelmersVisio Consultant, Trainer, Author, and Developer
Most Valuable Expert 2011

Commented:
You're very welcome.

I agree that basing your solution on Visio 2010 will simplify the project. And providing only Visio 2010 support is a good solution -- if you have control over your audience and what software they use. If not, then Visio 2007 support may be necessary sooner or later. If I can be of further assistance as you get started, feel free to post additional questions here. Also, if you're interested, I'd be happy to demonstrate the application I described in my response above -- it might give you some ideas.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial