XmlNameTableとは? わかりやすく解説

XmlNameTable クラス

最小単位分割され文字列オブジェクトテーブル

名前空間: System.Xml
アセンブリ: System.Xml (system.xml.dll 内)
構文構文

Public MustInherit Class
 XmlNameTable
public abstract class XmlNameTable
public ref class XmlNameTable abstract
public abstract class XmlNameTable
解説解説

XmlDocument や XmlReader などのクラスは、内部的に XmlNameTable クラス使用して属性名および要素名を格納します要素名または属性名が複数XML ドキュメント出現した場合は、XmlNameTable1 回だけ格納されます。

名前は、共通言語ランタイム (CLR) オブジェクト型として格納されます。これにより、負荷の高い文字比較ではなく、これらの文字列オブジェクト比較実行できます。これらの文字列オブジェクトatomizedstrings として参照されます。

XmlNameTable は NameTable クラス実装されます

使用例使用例

2 つ要素名を比較する例を次に示します

' 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.Object
  System.Xml.XmlNameTable
     System.Xml.NameTable
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

XmlNameTable コンストラクタ


XmlNameTable メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

XmlNameTable クラス
System.Xml 名前空間
NameTable クラス

XmlNameTable メンバ

最小単位分割され文字列オブジェクトテーブル

XmlNameTable データ型公開されるメンバを以下の表に示します


プロテクト コンストラクタプロテクト コンストラクタ
  名前 説明
プロテクト メソッド XmlNameTable XmlNameTable クラス新しインスタンス初期化します。
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

XmlNameTable クラス
System.Xml 名前空間
NameTable クラス


このページでは「.NET Framework クラス ライブラリ リファレンス」からXmlNameTableを検索した結果を表示しています。
Weblioに収録されているすべての辞書からXmlNameTableを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からXmlNameTable を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「XmlNameTable」の関連用語

XmlNameTableのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



XmlNameTableのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS