Hi All

I am trying to convert xml file to a text file. But my program creates an empty text file and does not copy any text from the xml file. Please help

Thanks

My code:

Dim Doc As New XmlDocument
Dim NodeList As XmlNodeList

Doc.Load("C:\Temp\MyXml.xml")
NodeList = Doc.SelectNodes("/response/TAG")
Dim sw As New StreamWriter("C:\Temp\MyXmlContents.txt", False)

For Each Node As XmlNode In NodeList
For i As Integer = 0 To Node.ChildNodes.Count - 1
With Node.ChildNodes.Item(i)
sw.WriteLine(.Name & ": " & .InnerText)
End With
Next
Next

sw.Close()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.