Dim path As String = PDA_PATH "ife.XML" ’PDA_PATH 為路徑
成都創(chuàng)新互聯(lián)公司是專業(yè)的來鳳網(wǎng)站建設(shè)公司,來鳳接單;提供成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè),網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進行來鳳網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!
Dim ds As New DataSet
ds.ReadXml(path)
Dim dt As DataTable = ds.Tables.Item(0)
Dim blnY As Boolean = True
For Each row As DataRow In dt.Rows
If row.Item("Translation").ToString.ToUpper ="確認(rèn)"Then
row.Item("Translation") =“替換”
blnY = False
Exit For
End If
Next
If blnY Then
MsgBox("輸入的XXX不存在,請重新輸入! ")
Return
End If
ds.WriteXml(path)
MessageBox.Show("修改數(shù)據(jù)并保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
或者
Dim xmlDoc As New XmlDocument()
'Dim nodeList As New XmlNodeList
xmlDoc.Load("life..xml") '加載
Dim nodeList As XmlNodeList = xmlDoc.SelectSingleNod.("UITranslations").ChildNodes '獲取bookstore節(jié)點的所有子節(jié)點
Dim xn As XmlNode
For Each xn In nodeList '遍歷所有子節(jié)點
Dim xe As XmlElement = CType(xn, XmlElement) '將子節(jié)點類型轉(zhuǎn)換為XmlElement類型
Dim nls As XmlNodeList = xe.ChildNodes '繼續(xù)獲取xe子節(jié)點的所有子節(jié)點
Dim xn1 As XmlNode
For Each xn1 In nls '遍歷
Dim xe2 As XmlElement = CType(xn1, XmlElement) '轉(zhuǎn)換類型
If xe2.Name = "Translation" Then '如果找到
xe2.InnerText ="替換"則修改
'Exit For Each '找到退出來就可以了
End If
Next xn1
Next xn
xmlDoc.Save("life.xml") '保存。
MessageBox.Show("修改XML成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
看能不能幫到你!
在緊挨著類或成員的上一行打三個單引號,自動生成XML注釋。
你可以使用para來換行。
使用see cref來標(biāo)明參考項。
Dim?xmlDoc?As?New?System.Xml.XmlDocument
xmlDoc.Load("c:\xml.xml")?'載入xml文件
Dim?Items?As?Xml.XmlNodeList?=?xmlDoc.DocumentElement.SelectNodes("http://record/item")?'參數(shù)為xpath查詢串,前面斜杠,//:表示任何結(jié)點,/:表示根結(jié)點
For?Each?s?As?Xml.XmlNode?In?Items
Console.WriteLine(s.Attributes.GetNamedItem("id").Value??vbTab??s.InnerText)
Next
DataSet 和 DataTable都有現(xiàn)成的方法:WriteXml
DataTable tb = this.dataGridView1.DataSource as DataTable;
if(tb != null)
{
tb.WriteXml(@"C:\table.xml",true);
return;
}
DataView dv = this.dataGridView1.DataSource as DataView;
if(dv != null)
{
dv.Table.WriteXml(@"C:\table.xml",true);
return;
}
IList list = this.dataGridView1.DataSource as IList;
if(list != null)
{
//to do,如果是IList,就要你自己想辦法導(dǎo)出了
//XmlDocument or XmlWriter都可以考慮
}