So I am trying to obtain some of the information for a XML file that looks like this....
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....
So for example if I was to plug into Role_Search_Val ue_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.
Code:
- <docuvault_settings> - <role_list> - <role obj_name="Logistics"> <role_type>master_role</role_type> - <members> <user domain_name="GFSPROD" account_name="aclippert" permission="000F" /> <user domain_name="GFSPROD" account_name="afarner" permission="000F" />
Here is my code....
Code:
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
Dim Name As String
Dim Permission As String
m_xmld = New XmlDocument()
m_xmld.Load("C:\Share\GR_Prd_DV1_roles.xml")
m_nodelist = m_xmld.SelectNodes("docuvault_settings/role_list/role")
For Each m_node In m_nodelist
Dim RoleNode As XmlNode = m_node.SelectSingleNode("members/user[@account_name='" & Role_Search_Value_1.Text & "']")
If RoleNode IsNot Nothing Then
Name = m_node.Attributes.GetNamedItem("obj_name").Value
Permission = m_node.Attributes.GetNamedItem("permission").Value
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.