Read XML File contents [Resolved]

Posted by MF-13693 under VB.NET on 2/7/2012 | Points: 10 | Views : 3837 | Status : [Member] | Replies : 1
Hi,

I want to read the text between the tags in the below xml file:

<?xml version="1.0" encoding="UTF-8"?>
<Settings>
<SrvName>SRV01\SQLEXPRESS</SrvName>
<DBName>dbKC</DBName>
<DBUser>sa</DBUser>
<DBPass>xx123</DBPass>
</Settings>
</xml>

I would like to use XMLTextReader class, any help is highly Apprecited.

Thx

Thx

M@F
Index was outside the bounds !!!



Responses

Posted by: Blessyjees on: 2/8/2012 [Member] Bronze | Points: 50

Up
0
Down

Resolved
Hi,

You can use XMLDocument to read xml. See below code

Dim doc As XmlDocument = New XmlDocument()

doc.Load("D:\VS2010\WindowsApplicationVB\test.xml")
Dim node As XmlNode
node = doc.GetElementsByTagName("DBUser")(0)
MessageBox.Show(node.InnerText)



Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

MF-13693, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response