read xml file nodes

S

Sam

Hi,
I've got the following xml file:

<?xml version="1.0" encoding="utf-8" ?>
<ToolTip>
<table tag="some explanations about tables"/>
<view tag="some explanations about views"/>
</ToolTip>

and with the following code i'm trying to read a particular node :

Public Function LoadToolTip(ByVal Form As String, ByVal Tag As String)
As String
Dim xDoc As New XmlDocument
Try
Dim filePath As String = "../ToolTips/" & Form & ".xml"
xDoc.Load(filePath)
Dim xNodeList As XmlNodeList = xDoc.SelectNodes("/ToolTip/"
& Tag & "/@tag")
Return xNodeList.Item(0).Value
Catch ex As Exception
MsgBox(ex.ToString)
End Try
end function

But xNodeList is always empty and that leads to a crash. What am I
doing wrong when reading the node ?

Thx
 
G

Guest

value where if you put this way.... <view tag"...">value</view>

the way youre putting, you must to try to find it in an attribute value...

i think it was, xnodelist.item(0).attribute(0).value or something like that...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top