简体   繁体   中英

How to convert Visio document .xml to csv file c#

I have multiple xml files, this files generated from convert .vsdx "Visio File" to .xml file, Now i want to convert the generated files from .xml to .csv files. My problem the files has hundreds lines and the xml shape tag can't be followed to extract csv file using xml tag. I work with this tool but the problem the out structure very complex there is any way to make that ?

Normally one solves this with XSLT. If you want to create a csv file programmatically I would query the xml file with Linq to Xml append each record as a csv formatted line into a StringBuilder instance and finally write the StringBuilders content into the target file.

I haven't worked with Visio based XML files but given that the XML'ishness is alike across any source (which it should be), I'd go LINQ2XML or, depending on what you feel convenient with read in the stuff as a XDocument (avoid XmlDocument , as it's older and obsolete ) and then parse it to a String .

It depends a bit on how complex files are and how invasive operations that you'll need to carry out.

As for the tool you mention, I haven't seen it before but it could be a better idea not to use it as it strikes me as a bit outdated. However, I only glanced at it without scrutinizing. If you only need to see the data for yourself (human based analysis of the contents), you might perhaps use a decent text editor with some appropriate plugin (such as Notepad++ and its XML add-on).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM