Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. XML XPath search in vb.net

XML XPath search in vb.net

Scheduled Pinned Locked Moved Visual Basic
xmlcsharpalgorithmshelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    japel
    wrote on last edited by
    #1

    Hi All, I posted this under XML but after reading some of the other posts, it was probably the wrong message board so here it is. OK I have worked out the below code to return the 'EN' string if I supply the string code, say "1000" of the below XML file but what I need to know is how to search for the string and return the string code. If I could use a wildcard in this it would be great. Any Thoughts??? Private Sub XPathSearch(ByVal XMLPath As String) Dim xmlNI As XPathNodeIterator Dim xpathDoc As XPathDocument Dim xmlNav As XPathNavigator Try xpathDoc = New XPathDocument(XMLPath) xmlNav = xpathDoc.CreateNavigator() xmlNI = xmlNav.Select("/MOMLANG/STRING[@code='" & stringValue & "']/LANG[@code='EN']") While (xmlNI.MoveNext()) 'Me.RichTextBox1.AppendText(xmlNI.Current.Name + " : " + xmlNI.Current.Value & vbCrLf) Me.RichTextBox1.AppendText("String value: " + xmlNI.Current.Value & vbCrLf) End While Catch ex As XPathException System.Console.WriteLine("XMLException: " + ex.Message) Catch ex As Exception System.Console.WriteLine("Exception: " + ex.Message) End Try End Sub I have worked with reading simple XML elements but have not worked with atributes and the like. I am also new to both XML and Dev in general. I have read several articles but most give me examples for reading simple XML e.g. John Smith The file I am trying to read is below, any help would be great and examples are very much welcome. My goal for the GUI in VB.NET will be to have a textbox to enter string number I am searching for and a dropdown but to select the language. Regards Jason Access Allowed List Access Allowed List Access Allowed List Access Allowed List Access Allowed List Access Allowed List Lista de accesos permitidos Pääsylista sallitut Liste des accès autorisés Access Allowed List Hozzáférés Engedély Lista Elenco accessi consentiti

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups