Using LinqToXml to explore a VXD drawing

Started by aledlund, October 05, 2011, 01:30:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aledlund

There's been interest on the Microsoft Visio Forums on how a developer might examine a Visio drawing which has been saved in an XML format (VXD). This sample project explores how LinqToXml in a Vb.NET solution could be used to examine some of the key feature areas that were released in Visio 2007 and 2010. The intent of the user is usually stated as desiring to be able to gather information from the drawing that might be used to create external reports, so the focus is on gathering information from shapes (shape sheet data), connections (page connections), and BPMN issues that were flagged in the drawing. While the sample program does include Visio for viewing the drawing file, it is not used for examining the contents of the drawing.

HTH,

al


YouTube
http://www.youtube.com/watch?v=bT53dnYC1c4

Source code
http://xmlvisio.codeplex.com/

references
' Visio XSD downloads
' http://www.microsoft.com/download/en/details.aspx?id=23976
'
' msdn linqtoxml samples
' http://code.msdn.microsoft.com/LINQ-Sample-Queries-13a42a54/sourcecode?fileId=22789&pathId=521681129
'
' orgchart example
' http://visguy.com/vgforum/index.php?topic=2298
'
' datarecordset example
' http://visguy.com/vgforum/index.php?topic=2474
'
' bpmn drawing example used with permission from Scott A. Helmers
' author of "Microsoft Visio 2010 Step by Step"
' http://www.visiostepbystep.com/
'
' Chris Roth's new book
' "Using Microsoft Visio 2010 "
' http://www.amazon.com/gp/product/0789742977/ref=as_li_ss_tl?ie=UTF8&tag=wanderkind-20&linkCode=as2&camp=217145&creative=399349&creativeASIN=0789742977
'
' Chris' xml presentation at developers conference
' http://www.visguy.com/2006/11/30/visio-and-xml-conference-resources/
'
' David Parker's book on bpmn
' "Microsoft Visio 2010 Business Process Diagramming and Validation"
' http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dstripbooks&field-keywords=david+parker+bpmn
'

Visio Guy

Nice video, Al!

So the classes generated by the xsd tool (I've used it before) aren't used at all in the project? Or are they used by some machine-generated code? It wasn't 100% clear to me, and I haven't had a chance to explore the project.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

aledlund

#2
Your'e correct the first time, I didn't use/call them at all with the embedded code. I just found it handy to go see how they were created. The general flow I used was to start with the tree diagram to see what attributes/elements were in the VXD drawing and then use VisualStudio's explorer to examine the appropriate XSD file. You probably noticed that I used the local names (xName) of the attributes. This might cause issues in some of them because (Layout as an example) some were changed in all three versions and you have to filter for the correct namespace to make sure you're looking at the correct one.
Al