XmlElement.OwnerDocument 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 노드가 속한 XmlDocument를 가져옵니다.
public:
virtual property System::Xml::XmlDocument ^ OwnerDocument { System::Xml::XmlDocument ^ get(); };
public override System.Xml.XmlDocument OwnerDocument { get; }
member this.OwnerDocument : System.Xml.XmlDocument
Public Overrides ReadOnly Property OwnerDocument As XmlDocument
속성 값
이 요소가 속한 XmlDocument
입니다.
예제
다음은 XML 문서에 새 요소를 삽입하는 예제입니다.
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
XmlDocument^ doc = gcnew XmlDocument;
doc->LoadXml( "<book genre='novel' ISBN='1-861001-57-5'><title>Pride And Prejudice</title></book>" );
XmlElement^ root = doc->DocumentElement;
// Create a new element.
XmlElement^ elem = doc->CreateElement( "price" );
elem->InnerText = "19.95";
// Display the new element's owner document. Note
// that although the element has not been inserted
// into the document, it still has an owner document.
Console::WriteLine( elem->OwnerDocument->OuterXml );
// Add the new element into the document.
root->AppendChild( elem );
Console::WriteLine( "Display the modified XML..." );
Console::WriteLine( doc->InnerXml );
}
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" +
"</book>");
XmlElement root = doc.DocumentElement;
// Create a new element.
XmlElement elem = doc.CreateElement("price");
elem.InnerText="19.95";
// Display the new element's owner document. Note
// that although the element has not been inserted
// into the document, it still has an owner document.
Console.WriteLine(elem.OwnerDocument.OuterXml);
// Add the new element into the document.
root.AppendChild(elem);
Console.WriteLine("Display the modified XML...");
Console.WriteLine(doc.InnerXml);
}
}
Imports System.IO
Imports System.Xml
public class Sample
public shared sub Main()
Dim doc as XmlDocument = new XmlDocument()
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"</book>")
Dim root as XmlElement = doc.DocumentElement
' Create a new element.
Dim elem as XmlElement = doc.CreateElement("price")
elem.InnerText="19.95"
' Display the element's owner document. Note
' that although the element has not been inserted
' into the document, it still has an owner document.
Console.WriteLine(elem.OwnerDocument.OuterXml)
'Add the element into the document.
root.AppendChild(elem)
Console.WriteLine("Display the modified XML...")
Console.WriteLine(doc.InnerXml)
end sub
end class
설명
현재 노드가 노드를 추가 하는 경우 사용 합니다 XmlDocument
반환한는 OwnerDocument
속성 노드를 만듭니다.