TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
hitesh.p.kapadia
NA
1
0
Reading multi level XML tags using VB.NET
Aug 3 2004 9:38 AM
Hello, I want to read the XML file using VB.NET. This XML file contains tags which are nested multi level. Following is the listing of my code to read the XML file. I am not able to retrieve the value of auth-title tag. Dim reader As XmlTextReader = New XmlTextReader("D:\Project\ReadXMLTest\Books1.xml") reader.WhitespaceHandling = WhitespaceHandling.None Dim a1 As New ArrayList Dim Title As String Dim firstName As String Dim lastName As String Dim authTitle As String Dim Price As Double reader.ReadStartElement() While Not reader.LocalName.Equals("bookstore") reader.Read() While Not reader.LocalName.Equals("book") Dim elementName As String = reader.LocalName 'reader.Read() Dim data As String = reader.ReadString If elementName.Equals("title") Then Title = data Response.Write(Title & "
") End If If elementName.Equals("auth-title") Then authTitle = data Response.Write(authTitle & "
") End If If elementName.Equals("first-name") Then firstName = data Response.Write(firstName & "
") End If If elementName.Equals("last-name") Then lastName = data Response.Write(lastName & "
") End If If elementName.Equals("price") Then Price = data Response.Write(Price & "
") End If reader.Read() End While reader.Read() End While Following is the XML file
ASP.NET Unleashed
Mr.
Hitesh
Kapadia
8.99
VB.NET Unleashed
Mr.
Jay
Kakar
11.99
Crystal Reports
Mr.
Vijay
Chandra
9.99
Reply
Answers (
0
)
Interfaces - Why we need them?
is this possible in .net