簡單的XML R/W 範例
Note:.net compact framework 2.0,Windows mibile 5.0 這篇主要是回復網友問題時做的測試程式,原文在 這邊 ,下面來看看測試的程式碼 XML內容是像下面這樣 程式碼部分 Imports System.Xml Public Class Form1 Dim xmlDoc As XmlDocument Dim strTmp As String = "" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load xmlDoc = New Xml.XmlDocument() ''載入XML文件 xmlDoc.Load(GetAppPath() & "\test.xml") End Sub Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click Dim xnodelist As Xml.XmlNodeList = xmlDoc.SelectNodes(txtXPath.Text) If xnodelist.Count > 0 Then DisplayXmlNode(xnodelist) Else TextBox1.Text = "Not found" End If End Sub Private Sub DisplayXmlNode(ByRef xNodeList As XmlNodeList) For Each x As Xml.XmlNode In xNodeList If x.HasChildNodes Then ...