| | |
reading a specific data in .txt file to put in specific tag in xml in vb.net
![]() |
•
•
Join Date: Jan 2008
Posts: 36
Reputation:
Solved Threads: 0
reading a specific data in .txt file to put in specific tag in xml in vb.net..pls help..
sample: BL% PHP 103025 and so on...
NL%
..
..
BL% and NL% are indicators where data should be placed in a specific segment in xml
PHP must be placed inside <currency></currency> tag..
103025 must be placed inside <amount></amount> tag..
sample: BL% PHP 103025 and so on...
NL%
..
..
BL% and NL% are indicators where data should be placed in a specific segment in xml
PHP must be placed inside <currency></currency> tag..
103025 must be placed inside <amount></amount> tag..
•
•
Join Date: Dec 2008
Posts: 10
Reputation:
Solved Threads: 0
Re: reading a specific data in .txt file to put in specific tag in xml in vb.net
0
#2 Dec 11th, 2008
This code may help:
I am assuming that you already know how to add the data to XML file(if you don't, you may learn it here) and that the data from text file you are reading from is stored in this way:
BL% PHP 103025
NL% Tag1 Tag2
VB Syntax (Toggle Plain Text)
Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load Dim filename As String = "afile.txt" ' Your file name/path Dim filereader As New System.IO.StreamReader(filename) ' Open the file for reading Dim readline As String Dim data As String Dim dataparts(1) As String While Not filereader.EndOfStream readline = filereader.ReadLine ' Reads a line from the text file Select Case readline.Substring(0, 3) ' Reads the first 3 Characters of the line Case "BL%" data = readline.Substring(4) ' Reads the data in front of 'BL%' dataparts = data.Split(" ") ' Breaks the data into two and store them in the dataparts array ' Add your codes for writing the data to the XML file in the 'BL%' segment between the currency and amount tag here Case "NL%" data = readline.Substring(4) dataparts = data.Split(" ") ' Add your codes for writing the data to the XML file in the 'NL%' segment here End Select End While End Sub
I am assuming that you already know how to add the data to XML file(if you don't, you may learn it here) and that the data from text file you are reading from is stored in this way:
BL% PHP 103025
NL% Tag1 Tag2
Last edited by NEo4; Dec 11th, 2008 at 4:00 am.
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- Open In New Window Php (PHP)
Other Threads in the VB.NET Forum
- Previous Thread: VB 2008 compile error
- Next Thread: complete records between two dates
Views: 1011 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access administrator application array arrays basic bindingsource browser button c# center client code combobox complex connection control convert cpu crystal crystalreport data database datagrid datagridview date datetimepicker design designer dissertation dissertations error excel file form gridview image images insert listview login loops mobile ms msaccess net openxml path picturebox port print printing problem read remove row save search security sensors serial server settings shutdown sms socket sorting sql statement studio syntax tagging tags text textbox time timer type update upload user validation vb vb.net vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web webbrowser windows wpf xml





