XmlDocument.NameTable 屬性


取得與這個實作關聯的 XmlNameTableGets the XmlNameTable associated with this implementation.

 property System::Xml::XmlNameTable ^ NameTable { System::Xml::XmlNameTable ^ get(); };
public System.Xml.XmlNameTable NameTable { get; }
member this.NameTable : System.Xml.XmlNameTable
Public ReadOnly Property NameTable As XmlNameTable


XmlNameTable,可讓您取得文件中字串之擷取版本。An XmlNameTable enabling you to get the atomized version of a string within the document.


XmlDocument個物件都NameTable有一個物件。Each XmlDocument object has a NameTable object. 元素和屬性名稱會儲存在中NameTable成為不可部分完成的字串。Element and attribute names are stored in the NameTable as atomized strings. 這表示即使在檔中多次參考名稱, 也會在中NameTable只儲存一次。This means that even if a name is referenced in the document multiple times it is stored only once in the NameTable. 例如, 如果檔有多個名稱為 "Customer" 的元素, 則NameTable每當收到該名稱的要求時, 就會傳回相同的物件。For example, if the document had multiple elements with the name "Customer", NameTable returns the same object whenever it receives a request for that name. 因此, 使用者可以在這些字串上使用物件比較來撰寫程式碼, 而不是以較昂貴的字串比較為代價。As a result, users can write code using object comparisons on these strings rather than the more expensive string comparisons.

如需已儘量縮減之字串的詳細資訊,請參閱 XmlNameTableFor more information on atomized strings, see XmlNameTable.

這個方法是檔物件模型 (DOM) 的 Microsoft 擴充功能。This method is a Microsoft extension to the Document Object Model (DOM).