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. 元素和属性名称作为原子化字符串存储在中 NameTableElement and attribute names are stored in the NameTable as atomized strings. 这意味着,即使在文档中多次引用某个名称,它也只会在中存储一次 NameTableThis 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).