473,512 Members | 15,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read A XML File In VB.NET

4 New Member
So I am trying to obtain some of the information for a XML file that looks like this....

Expand|Select|Wrap|Line Numbers
  1. - <docuvault_settings>
  2. - <role_list>
  3. - <role obj_name="Logistics">
  4.   <role_type>master_role</role_type> 
  5. - <members>
  6.   <user domain_name="GFSPROD" account_name="aclippert" permission="000F" /> 
  7.   <user domain_name="GFSPROD" account_name="afarner" permission="000F" /> 
  8.  
The issue I am having is my code is getting the first parts of what I want which are the rol obj_name and the user account_name but for some reason I can not figure out how to obtain the permission value.

Here is my code....
Expand|Select|Wrap|Line Numbers
  1. Dim m_xmld As XmlDocument
  2.         Dim m_nodelist As XmlNodeList
  3.         Dim m_node As XmlNode
  4.         Dim Name As String
  5.         Dim Permission As String
  6.  
  7.         m_xmld = New XmlDocument()
  8.         m_xmld.Load("C:\Share\GR_Prd_DV1_roles.xml")
  9.         m_nodelist = m_xmld.SelectNodes("docuvault_settings/role_list/role")
  10.  
  11.         For Each m_node In m_nodelist
  12.  
  13.             Dim RoleNode As XmlNode = m_node.SelectSingleNode("members/user[@account_name='" & Role_Search_Value_1.Text & "']")
  14.  
  15.             If RoleNode IsNot Nothing Then
  16.  
  17.                 Name = m_node.Attributes.GetNamedItem("obj_name").Value
  18.                 Permission = m_node.Attributes.GetNamedItem("permission").Value
  19.  
So for example if I was to plug into Role_Search_Value_1.Text the value of afarner I should get a return of the role obj_name which would be Logistics, the account_name which would be afarner because thats who we searched for with the above code and the permission which would be 000F. For some reason I am not getting the permission though. I am very new to reading XML so I think I am not doing something right with xpath.

Can somebody please guide me through it and show me where I am going wrong? I am doing this through VB.NET

Thank you in advance.
Aug 14 '08 #1
0 809

Sign in to post your reply or Sign up for a free account.

Similar topics

10
5303
by: Yang Li Ke | last post by:
Hi guys! I have some datas that I must check everytime a visitor comes to my site What is better to do: 1- Read data from a file or 2- Read data from a mysql db Thank you
10
2262
by: ZafT | last post by:
Thanks in advance for any tips that might get me going in the right direction. I am working on a simple exercise for school that is supposed to use read to read a file (about 10 MB). I am...
1
6722
by: cnu | last post by:
My program generates a log file for every event that happens in the program. So, I open the file and keep it open till the end. This is how I open the file for writing: <CODE> public...
4
2712
by: ESPN Lover | last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one way preferred over the other and why? Thanks. using System; using System.IO; class Test { public static void...
8
23886
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
5
3282
by: lovecreatesbea... | last post by:
The condition at line 31 is added to check if the program finished to read the whole file. Is it needed and correct? Thank you. #include <fstream> #include <iostream> #include <string> using...
0
5750
by: lovecarole | last post by:
hi, i am the student who should write a program about reading wav file and do the DFT. actually i don't know how to read data of the wav song and save it into the array... if i want to read...
6
32846
by: Thomas Kowalski | last post by:
Hi, currently I am reading a huge (about 10-100 MB) text-file line by line using fstreams and getline. I wonder whether there is a faster way to read a file line by line (with std::string line)....
9
7366
by: flebber | last post by:
I was working at creating a simple program that would read the content of a playlist file( in this case *.k3b") and write it out . the compressed "*.k3b" file has two file and the one I was trying...
2
5439
by: Kevin Ar18 | last post by:
I posted this on the forum, but nobody seems to know the solution: http://python-forum.org/py/viewtopic.php?t=5230 I have a zip file that is several GB in size, and one of the files inside of it...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
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
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7517
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
5676
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,...
1
5077
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...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.