leoretorico Posted March 4, 2014 at 03:27 PM Report #547501 Posted March 4, 2014 at 03:27 PM Boa tarde pessoal Preciso ler um arquivo xml,online ... (um link do yahoo, um webservice com cotações de moedas) e passar para uma textbox o valor do Dólar . http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote mas realmente eu não sei trabalhar com xml .... Por exemplo na imagem que anexo à este post , tem um campo marcado : USD/VND como eu posso fazer para pegar o valor "PRICE " logo abaixo dele?
nelsonr Posted March 4, 2014 at 03:58 PM Report #547503 Posted March 4, 2014 at 03:58 PM (edited) Provavelmente dá para optimizar a parte do xpath, mas pode ser algo deste tipo: Dim xmlDoc As XmlDocument = New XmlDocument() xmlDoc.Load("http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote") For Each node As XmlNode In xmlDoc.DocumentElement.SelectNodes("//resource") If node.SelectSingleNode("field[@name='name']").InnerText = "USD/MOP" Then MessageBox.Show(node.SelectSingleNode("field[@name='price']").InnerText) Exit For End If Next Edited March 4, 2014 at 03:58 PM by nelsonr 1 Report
leoretorico Posted March 4, 2014 at 04:15 PM Author Report #547505 Posted March 4, 2014 at 04:15 PM Ok muito obrigado!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now