0

I want to process MSXML which is generated by Visio 2010, Which Language will be helpful to work with the generated XML, i`m very new to this,

Visual basic, .Net or C# will help me?

Regards

Felix Christy
  • 2,179
  • 1
  • 19
  • 32

2 Answers2

1

C# and VB.NET both provide equivalent support for XML because they share the same framework and can utilize all the same libraries. There are many ways to skin the cat, so it all depends what makes the most sense in your situation. You can load the XML with a DataSet. You can use the XmlDocument class to load it and then search through it with XPath. You can load it with the XDocument class and search through it with LINQ. You can deserialize the XML into a matching custom class object. Or, if you are interested in transforming the XML document into another XML or other format, I would recommend using XSLT. You can apply XSLT scripts to XML documents in .NET using the XslCompiledTransform class. You could easily find examples for all of these online, including on this site, by searching around for each one.

Steven Doggart
  • 43,358
  • 8
  • 68
  • 105
  • Do you have any idea about Visio, which one you feel a better tool – Prashanth M P Jun 18 '12 at 13:01
  • It's all the same. It doesn't matter what the XML schema is. The tools work the same no matter what format of XML they are reading. The question is, rather, what do you need to do with the XML? Are you transforming it to another format, loading the document, just reading a couple properties out of it, making modifications to the data it contains, etc.? Those are the kinds of things that would change which tool would work best for the job. – Steven Doggart Jun 18 '12 at 13:05
  • Also, depending on what you are trying to do, you may want to look at the Visio COM libraries which allow you to integrate with Visio, itself, from within your application. http://support.microsoft.com/kb/305199 – Steven Doggart Jun 18 '12 at 13:12
  • VB.Net actually does have additional support for XML due to the inclusion of XML Literals directly in the language as syntactic sugar for the LINQ to XML implementation. Otherwise, I agree with your assessment. – Jim Wooley Jun 18 '12 at 15:56
  • @SteveDog Actually based on some field values i`ve to extract the data from XML and create an excel, consider in visio file you have 4 flows so i`ve to create 4 separate files for 4 flows with the data corresponding to each flow, if it has 5 flow 5 files and so on – Prashanth M P Jun 19 '12 at 04:07
  • @PrashanthMP XSLT can only output one file, so you'd have to apply the same script multiple times, passing in a parameter each time to specify which flow to extract. So, you'd still have to preload the XML using some other method to determine which flows need to be extracted and then loop through applying the script for each one. So, while it would still work, unless you really need the post-compile-time flexibility that XSLT provides, it doesn't sound like that's your best option. – Steven Doggart Jun 19 '12 at 12:17
  • @PrashanthMP Also, since the input and output XML files have relatively complex schemas, it sounds like serialization probably isn't the best option either. So, that leaves XmlDocument/XPath and XDocument/LINQ. They both essentially serve the same purpose. XPath is an industry-standard language for selecting nodes, so it is good in that sense. LINQ, on the other hand, is Microsoft's proprietary new fangled way for accessing XML without XPath (but it also does a whole lot more than just XML). It's generally considered the new and shiny alternative to XmlDocument. – Steven Doggart Jun 19 '12 at 12:23
  • @PrashanthMP However, before going down any of these roads any further, I would recommend taking a serious look at the Microsoft libraries that allow you to integrate with Visio and Excel to see how much of what you need to do can be done through those libraries. I would say that the more of the task that you can do through those libraries, the better off you'll be. – Steven Doggart Jun 19 '12 at 12:25
-1

Both Visual Basic and C# have a number of ways of accessing and manipulating XML data. I suggest that you have a look at the LINQ-to-XML features available in both of these .Net languages.

Steve Bird
  • 222
  • 9
  • 17