The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
XmlDocumentFragment::OwnerDocument Property
.NET Framework (current version)
Gets the XmlDocument to which this node belongs.
Assembly: System.Xml (in System.Xml.dll)
When adding nodes to the current node, use the XmlDocument returned by the OwnerDocument property to create the node.
The following example adds a new node to the document fragment.
#using <System.Xml.dll> using namespace System; using namespace System::IO; using namespace System::Xml; int main() { // Create the XmlDocument. XmlDocument^ doc = gcnew XmlDocument; doc->LoadXml( "<items/>" ); // Create a document fragment. XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); // Display the owner document of the document fragment. Console::WriteLine( docFrag->OwnerDocument->OuterXml ); // Add nodes to the document fragment. Notice that the // new element is created using the owner document of // the document fragment. XmlElement^ elem = doc->CreateElement( "item" ); elem->InnerText = "widget"; docFrag->AppendChild( elem ); Console::WriteLine( "Display the document fragment..." ); Console::WriteLine( docFrag->OuterXml ); }
Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 10
.NET Framework
Available since 1.1
Show: