reading xml elements using xdocument problem [Resolved]

Posted by Sakthi.Singaravel under VB.NET on 3/27/2012 | Points: 10 | Views : 2146 | Status : [Member] | Replies : 1
when i trying xml elements using xdocument its takes whole file in two parts only..
Coding as follows :

inputfolder = TextBox_input.Text
outputfolder = TextBox_output.Text
If Directory.Exists(inputfolder) = False Then
MsgBox("Input folder does not exists. Please check again...", vbInformation, ProjectName)
Exit Sub
End If
Dim files As ReadOnlyCollection(Of String)
files = My.Computer.FileSystem.GetFiles(inputfolder, FileIO.SearchOption.SearchAllSubDirectories, "*.xml")
For Each filee In files
outputfile = outputfolder & "\" & Regex.Replace(filee, ".*?\\(.[^\\]*?)\.xml$", "$1") & "_Figure_list.log"
Dim wr As New StreamWriter(outputfile)
Dim file_cont As String = File.ReadAllText(filee, System.Text.Encoding.Default)
file_cont = Regex.Replace(file_cont, "&", "&", RegexOptions.IgnoreCase)
Dim temp_file As XDocument = XDocument.Parse(file_cont,LoadOptions.PreserveWhitespace)
Dim count As Integer = 0
For Each fig_Ele As XElement In temp_file.Elements
matchhash.Add(count, fig_Ele.ToString())
count += 1
Dim i As Integer = 0
Next
wr.Close()
Next

Regards,
Singaravel M



Responses

Posted by: Sakthi.Singaravel on: 2/28/2013 [Member] Silver | Points: 25

Up
0
Down

Resolved
need to declare NameSpace...

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response