7.10. Convert an XML File to a Delimited File (and Vice Versa)


You need to convert the contents of an XML file to a text file with delimited fields or convert a text file with delimited fields to an XML file.


To transform XML data to a delimited text file, use a LINQ query to retrieve and data and project it into an appropriate format. To transform the delimited text file to an XML tree, read and parse the data while creating the necessary XML nodes using XML literals and embedded expressions.

How It Works

LINQ to XML gives you the power to quickly and easily transform XML data to and from different formats by altering or transforming XML nodes within a LINQ query. If you need to transform the data in an existing XML tree into ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.