Skip to content

Instantly share code, notes, and snippets.

@tamago324
Last active October 5, 2017 03:01
Show Gist options
  • Save tamago324/e89adcfef85d2bae82f42426674c337c to your computer and use it in GitHub Desktop.
Save tamago324/e89adcfef85d2bae82f42426674c337c to your computer and use it in GitHub Desktop.
XMLを読み込む
Imports System.Xml
Module Module1
Sub Main()
Console.WriteLine("Start!")
' XMLを扱うためのオブジェクト
Dim xmlDoc As New XmlDocument()
' XMLを読み込み
xmlDoc.Load("C:\test.xml")
' food というタグのリストを取得
Dim foods As XmlNodeList = xmlDoc.GetElementsByTagName("food")
For Each food As XmlNode In foods
' foodタグのname属性と値を出力
Debug.Print(food.Attributes("name").Value + ": " + food.InnerText)
Next
Console.WriteLine("End!")
End Sub
End Module
<foods>
<food name="バナナ">黄色</food>
<food name="リンゴ">赤</food>
</foods>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment