本文整理汇总了VB.NET中System.Xml.XmlNameTable类的典型用法代码示例。如果您正苦于以下问题:VB.NET XmlNameTable类的具体用法?VB.NET XmlNameTable怎么用?VB.NET XmlNameTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlNameTable类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: NameTable
' Add the element names to the NameTable.
Dim nt As New NameTable()
Dim book As Object = nt.Add("book")
Dim title As Object = nt.Add("title")
' Create a reader that uses the NameTable.
Dim settings As New XmlReaderSettings()
settings.NameTable = nt
Dim reader As XmlReader = XmlReader.Create("books.xml", settings)
While reader.Read()
If reader.NodeType = XmlNodeType.Element Then
' Cache the local name to prevent multiple calls to the LocalName property.
Dim localname As Object = reader.LocalName
' Do a comparison between the object references. This just compares pointers.
If book Is localname Then
' Add additional processing here.
End If
' Do a comparison between the object references. This just compares pointers.
If title Is localname Then
' Add additional processing here.
End If
End If
End While
' Close the reader.
reader.Close()