CSV to XML

The following is a way to move from CSV to XML Node. If one were to want to manually structure an xml node,  there is an alternative way to create xml nodes from CSV files that is fast and easy and can be done in the following form:

Dim ReferenceToElement as XElement =

<nameOfTheNode>

<%= From strings In StringArray

Let fields = Split(strs, “,”)

Select

<rows>

<column1><%= fields(0)%></column1>

</rows>

%>

</nameOfTheNode>

This takes in a string taken from the csv file and put in an array called String Array. This then only takes the first item (fields 0), and puts it in the column of the new xelement. Then once this is done the xelement must be converted into a node.  And this is done in the following code:

Dim xn As XmlNode = XmlDoc.ReadNode(ReferenceToElement.CreateReader)

Now xn can be inserted as a new child or any other task that would need to be done with a xml node. This method allows direct control over the structure of the node without the complexity of creating a table and allows for very fast manipulation of data into a xml node. This is to the advantage of the user as the nodes are a very easy way to insert data into a xml document. Situations could be adding text to an html email or manipulation of data on a website. The most relevant website for this would be the Microsoft developer network on the subject. https://msdn.microsoft.com/en-us/library/bb387090(v=vs.100).aspx