Export (0) Print
Expand All

XmlImplementation.CreateDocument Method

Creates a new XmlDocument.

[Visual Basic]
Public Overridable Function CreateDocument() As XmlDocument
[C#]
public virtual XmlDocument CreateDocument();
[C++]
public: virtual XmlDocument* CreateDocument();
[JScript]
public function CreateDocument() : XmlDocument;

Return Value

The new XmlDocument object.

Remarks

XmlDocument objects created from the same implementation share the same name table. This enables users to compare attribute and element names between the objects more efficiently.

Although the XmlDocument objects share the same implementation, to move nodes from one document to another you must use the ImportNode method.

Example

[Visual Basic, C#, C++] The following example creates two XmlDocument objects from the same implementation.

[Visual Basic] 
Dim imp As New XmlImplementation()
Dim doc1 As XmlDocument = imp.CreateDocument()
Dim doc2 As XmlDocument = imp.CreateDocument()

[C#] 
XmlImplementation imp = new XmlImplementation();
XmlDocument doc1 = imp.CreateDocument();
XmlDocument doc2 = imp.CreateDocument();

[C++] 
XmlImplementation* imp = new XmlImplementation();
XmlDocument* doc1 = imp->CreateDocument();
XmlDocument* doc2 = imp->CreateDocument();

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

XmlImplementation Class | XmlImplementation Members | System.Xml Namespace | NameTable

Show:
© 2014 Microsoft