XmlNameTable 类
.NET Framework (current version)
程序集: System.Xml(位于 System.Xml.dll)
' 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()
通用 Windows 平台
自 8 起可用 .NET Framework 自 1.1 起可用 可移植类库 在 可移植 .NET 平台 中受支持 Silverlight 自 2.0 起可用 Windows Phone Silverlight 自 7.0 起可用 Windows Phone 自 8.1 起可用 此类型的所有公共静态(Visual Basic 中的 已共享 在 Visual Basic 中)成员都是线程安全的。不保证所有实例成员都是线程安全的。 |
|
来自: 龙门过客栈 > 《System.Xml》