VB.NET Working with XML?

2

I'm filling a ComboBox from a Xml :

Dim mXml As New XmlDocument
Dim Arquivo As New IO.FileInfo(My.Application.Info.DirectoryPath & "\Configuracao.xml")
mXml.Load(Arquivo.FullName)

Dim SearchMusic As New DataSet
SearchMusic.ReadXml(Arquivo.ToString)
Me.ComboBox_list.DisplayMember = "Nome"
Me.ComboBox_list.DataSource = SearchMusic.Tables(0)
SearchMusic = Nothing

My XML is as follows:

<Musicas>    
  <Musica>    
    <Nome>teste1</Nome>    
    <Path>D:\teste</Path>    
  </Musica>    
  <Musica>    
    <Nome>Teste2</Nome>  
    <Path>c:\</Path>
 </Musica>
 <Musica>    
    <Nome>Tesssste</Nome>    
    <Path>c:\Windows\</Path>    
 </Musica>    
</Musicas>

I need to know how to fetch the contents of tag Path according to the name, eg:

  • I write teste1 it needs to return D:\teste , can it do that?
asked by anonymous 07.11.2017 / 15:56

1 answer

0

Your initial implementation is redundant and fails on some points, for example:

Dim SearchMusic As New DataSet
SearchMusic.ReadXml(My.Application.Info.DirectoryPath & "\Configuracao.xml")
Me.ComboBox_list.DisplayMember = "Nome"
Me.ComboBox_list.DataSource = SearchMusic.Tables(0)

18.11.2017 / 04:26