XmlDocument.Implementation 属性

定义

获取当前文档的 XmlImplementation 对象。Gets the XmlImplementation object for the current document.

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

属性值

当前文档的 XmlImplementation 对象。The XmlImplementation object for the current document.

示例

下面的示例使用另一个文档的实现创建新 XmlDocumentThe following example creates a new XmlDocument using another document's implementation.

XmlDocument^ doc1 = gcnew XmlDocument;
doc1->Load( "books.xml" );
XmlDocument^ doc2 = doc1->Implementation->CreateDocument();
XmlDocument doc1 = new XmlDocument();
 doc1.Load("books.xml");
 XmlDocument doc2 = doc1.Implementation.CreateDocument();
Dim doc1 As New XmlDocument()
doc1.Load("books.xml")
Dim doc2 As XmlDocument = doc1.Implementation.CreateDocument()

注解

从同一 XmlImplementation 创建的 XmlDocument 对象共享相同的 XmlNameTableXmlDocument objects created from the same XmlImplementation share the same XmlNameTable. 这允许用户将属性和元素名称比较为对象而不是字符串。This allows users to compare attribute and element names as objects rather than strings.

尽管 XmlDocument 对象共享相同的实现,但若要将节点从一个文档移到另一个文档,则必须使用 ImportNode 方法。Although the XmlDocument objects share the same implementation, to move nodes from one document to another you must use the ImportNode method.

适用于