|
-
May 2nd, 2003, 12:32 AM
#1
Read From XML
Hi All
I want to read a particular data from an XML
e.g in the XML given below From node Services
I want to read value for Path or Frequency.
<Services>
<Path>E:\Attach2\ISE\TCG\</Path>
<Frequency>120</Frequency>
<LogFilePath>G:\TLOG\ISE\Test.txt</LogFilePath>
<FileExtn>.xls</FileExtn>
<Application>Mock2</Application>
</Services>
How to achieve this in VB.Net?
Last edited by Kate_For_U; May 2nd, 2003 at 12:35 AM.
-
May 2nd, 2003, 03:39 AM
#2
Easiest is to read your xml file into a dataset.
Code:
Dim path As String
Dim ds As New System.Data.DataSet
ds.ReadXml("your xml file.xml")
path = ds.Tables("Services").Rows(0).Item("Path").ToString
Danny
Last edited by DdH; May 2nd, 2003 at 03:41 AM.
-
May 2nd, 2003, 04:23 AM
#3
The use of dataset can be done , but then this would add one more object.
Isn't there an inbuilt feature of .Net to do this.
-
May 5th, 2003, 10:23 PM
#4
Look at SYSTEM.XML namespace. The steps should be:
1. Use XMLDOCUMENT object to read that XML string/file
2. Use SelectSingleNode() method of XMLDOCUMENT object to get the node (PATH or FREQUENCY) that you want.
3. Use Text property (i think that is the property that holds TEXT value for XMLNODE) to get the value of that node.
-Cool Bizs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|