Last active
October 5, 2017 03:01
-
-
Save tamago324/e89adcfef85d2bae82f42426674c337c to your computer and use it in GitHub Desktop.
XMLを読み込む
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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