473,414 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

read xml file nodes

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

Nov 21 '05 #1
2 1177
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...
--
Salute by the First Time!
"Sam" wrote:
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

Nov 21 '05 #2
Sam
I'm sorry could you explain again, I don't understand your reply ?
Thank you.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Raghu Gupta | last post by:
Hi, Actually i am facing some problem using quickbooks and presently i am not so expert in using it. I am using c# code to retrive the data from quickbooks. it doesn't matter which language we...
1
by: René Paschold | last post by:
Hello, i write a xml file with following code: Dim xWriter As New XmlTextWriter(SaveFileContent.FileName, _ Encoding.UTF8) With xWriter .Formatting = Formatting.Indented
9
by: B-Dog | last post by:
I'm trying to read two nodes in an xml file that I'm using to store setting but I'm having a hard time trying to read the values of two nodes. Below I can read one node but I need to be able to...
10
by: JJ | last post by:
How can I get a SiteMapNodeCollection to output as an XML file?
4
by: Pim75 | last post by:
Hello, I have to read a XML file in ASP and save the values in a database. I can get this work, but I cannot read some nested nodes of the xml file. This is a part of the XML file: ...
4
by: Gerrit | last post by:
It must be simple, but I don't find how I can read a XmlFile in an ArrayList. Sample of my XmlFile: <?xml version="1.0" encoding="utf-8" ?> <Relations> <Person> <FirstName>John</FirstName>...
3
by: Alan T | last post by:
This is my xml file content: <?xml version="1.0"?> <server> <mssqlChicago> <host>www.chicagoserver.com</host> <user>managerA</user> <password>ceoman</password> <db>dbCEO</db> </mssqlChicago>
6
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem :...
0
by: Kavitha Sudhershan | last post by:
hi, i wanna read the node values from xml. As per my code i can read the node values in first child node and for the next node am not able to read the node values. pls help me. i'll paste the code...
6
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
Hi, can someone please let me know how I can read xml elements using object oriented program. I created a class to use the get and set properties however I dont know how I can pass the values from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.