How to generate simple xml code to import into visio

Hi Experts,

I want my VB-Application to generate xml-Code that later on can be opened in Visio 2003.
This as about orga charts, so in my xml code I need to generate the shapes that are necessary for an orga chart.
When I create an orga chart in Visio 2003 and export it to an vsx file, I get a very large file, even if I set the PreviewDocument property off.

What I need is a rather simple examle of an xml file that contains the most important properties like how to create the 3 or 4 different shapes for an ograchart and connections between them. An overview over the "syntax" for the most common features would be greate, too.

Thanks for your help!

Kai

Lupo09Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Scott HelmersConnect With a Mentor Visio Consultant, Trainer, Author, and DeveloperCommented:
You're right that the amount of code produced by Visio's Save as XML is pretty absurd. In stark contrast to that code, it takes a surprisingly small amount of XML to actually create a Visio drawing, so your question is very appropriate.

Chris Roth (aka "The Visio Guy") made a presentation on this subject at the 2006 Visio Conference and though it was four years ago, the content is still very relevant. His slides and code samples are available at the second link.

One other thought -- unless you specifically need XML for some other reason, are you aware that your code can run the Org Chart wizard directly? This is especially useful if the data from which you want to create the org chart already exists in SQL or Excel or various other data sources. This article from Microsoft describes the command line parameters and if you'd like to see an example with sample code, I co-wrote an article about automating the creation of org charts, albeit for a somewhat unique purpose.

Regards,
Scott
 
0
 
arch-itectCommented:
Here is the reference (wait for it to load completely) :

http://msdn.microsoft.com/en-us/library/Aa218408
http://msdn.microsoft.com/en-us/library/aa830812(v=office.10).aspx

Here are some MSXML utilities that might be helpful in generating xml from an xml schema

http://msdn.microsoft.com/en-gb/data/bb190600.aspx
0
 
Lupo09Author Commented:
Hi Folks,
the links provided by arch-itect helped gathering valuable information on how to deal with XML-and Visio, thanks!
Your approach, Scott, to built up an orga chart using the Excel Import Wizard within an VBA script is a really great idea! I do not really rely on XML, but I would prefer it, because I could have my Application create the XML-File regardless if Visio or Excel is installed.
I think, I will go for your solution and export my Orga Data to Excel, create a Visio Object within my App and use your example code to import the Orga Data using the Visio Wizard. Users who would use this function can be told to have Visio and Excel installed.

Nevertheless, If anybody has an example of an tiny little xml-file that can be opened in Visio as an Orga Chart, I would appreciate that very much. (I was experimenting for  hours and don't seem to come to a solution...)

Thanks a lot to all of you!

Kai
0
 
Lupo09Author Commented:
Although my approach was another one, your solution is a very elegant way to come to the same result.

Thanks,

Kai
0
All Courses

From novice to tech pro — start learning today.