本文整理汇总了VB.NET中System.Xml.XmlNode.SelectNodes方法的典型用法代码示例。如果您正苦于以下问题:VB.NET XmlNode.SelectNodes方法的具体用法?VB.NET XmlNode.SelectNodes怎么用?VB.NET XmlNode.SelectNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了XmlNode.SelectNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Sample
' 导入命名空间
Imports System.IO
Imports System.Xml
public class Sample
public shared sub Main()
'Create the XmlDocument.
Dim doc as XmlDocument = new XmlDocument()
doc.Load("booksort.xml")
Dim book as XmlNode
Dim nodeList as XmlNodeList
Dim root as XmlNode = doc.DocumentElement
nodeList=root.SelectNodes("descendant::book[author/last-name='Austen']")
'Change the price on the books.
for each book in nodeList
book.LastChild.InnerText="15.95"
next
Console.WriteLine("Display the modified XML document....")
doc.Save(Console.Out)
end sub
end class
示例2: Sample
' 导入命名空间
Imports System.IO
Imports System.Xml
public class Sample
public shared sub Main()
Dim doc as XmlDocument = new XmlDocument()
doc.Load("booksort.xml")
'Create an XmlNamespaceManager for resolving namespaces.
Dim nsmgr as XmlNamespaceManager = new XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("bk", "urn:samples")
'Select and display the value of all the ISBN attributes.
Dim nodeList as XmlNodeList
Dim root as XmlElement = doc.DocumentElement
nodeList = root.SelectNodes("/bookstore/book/@bk:ISBN", nsmgr)
Dim isbn as XmlNode
for each isbn in nodeList
Console.WriteLine(isbn.Value)
next
end sub
end class