Windows apps
Collapse the table of content
Expand the table of content
Information
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.

XmlAttribute::OwnerDocument Property

 

Gets the XmlDocument to which this node belongs.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public:
property XmlDocument^ OwnerDocument {
	virtual XmlDocument^ get() override;
}

Property Value

Type: System.Xml::XmlDocument^

An XML document to which this node belongs.

The following example creates an attribute and displays its OwnerDocument.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->LoadXml( "<book><title>Pride And Prejudice</title></book>" );

   //Create an attribute.
   XmlAttribute^ attr;
   attr = doc->CreateAttribute( "bk", "genre", "urn:samples" );
   attr->Value = "novel";

   //Display the attribute's owner document. Note
   //that although the attribute has not been inserted
   //into the document, it still has an owner document.
   Console::WriteLine( attr->OwnerDocument->OuterXml );
}

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft