XmlNameTable クラス
アセンブリ: System.Xml (system.xml.dll 内)


XmlDocument や XmlReader などのクラスは、内部的に XmlNameTable クラスを使用して、属性名および要素名を格納します。要素名または属性名が複数回 XML ドキュメントに出現した場合は、XmlNameTable に 1 回だけ格納されます。
名前は、共通言語ランタイム (CLR) オブジェクト型として格納されます。これにより、負荷の高い文字列比較ではなく、これらの文字列でオブジェクト比較を実行できます。これらの文字列オブジェクトは atomizedstrings として参照されます。

' 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()
// Add the element names to the NameTable. NameTable nt = new NameTable(); object book = nt.Add("book"); object title = nt.Add("title"); // Create a reader that uses the NameTable. XmlReaderSettings settings = new XmlReaderSettings(); settings.NameTable = nt; XmlReader reader = XmlReader.Create("books.xml", settings); while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { // Cache the local name to prevent multiple calls to the LocalName property. object localname = reader.LocalName; // Do a comparison between the object references. This just compares pointers. if (book == localname) { // Add additional processing here. } // Do a comparison between the object references. This just compares pointers. if (title == localname) { // Add additional processing here. } } } // End While // Close the reader. reader.Close();

System.Xml.XmlNameTable
System.Xml.NameTable


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からXmlNameTable クラスを検索する場合は、下記のリンクをクリックしてください。

- XmlNameTable クラスのページへのリンク