XmlDocument.WriteTo(XmlWriter) XmlDocument.WriteTo(XmlWriter) XmlDocument.WriteTo(XmlWriter) XmlDocument.WriteTo(XmlWriter) Method

정의

XmlDocument 노드를 지정된 XmlWriter에 저장합니다.Saves the XmlDocument node to the specified XmlWriter.

public:
 override void WriteTo(System::Xml::XmlWriter ^ w);
public override void WriteTo (System.Xml.XmlWriter w);
override this.WriteTo : System.Xml.XmlWriter -> unit
Public Overrides Sub WriteTo (w As XmlWriter)

매개 변수

w
XmlWriter XmlWriter XmlWriter XmlWriter

저장할 대상 XmlWriter입니다.The XmlWriter to which you want to save.

예제

다음 예제에서는 화면에 표시 되는 문서를 표시합니다.The following example displays the document onscreen.

void WriteXml( XmlDocument^ doc )
{
   XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
   writer->Formatting = Formatting::Indented;
   doc->WriteTo( writer );
   writer->Flush();
   Console::WriteLine();
}

public static void WriteXml( XmlDocument doc )
 {
    XmlTextWriter writer = new XmlTextWriter(Console.Out);
    writer.Formatting = Formatting.Indented;
    doc.WriteTo( writer );
    writer.Flush();
    Console.WriteLine();
 }
Public Shared Sub WriteXml(doc As XmlDocument)
    Dim writer As New XmlTextWriter(Console.Out)
    writer.Formatting = Formatting.Indented
    doc.WriteTo(writer)
    writer.Flush()
    Console.WriteLine()
End Sub 'WriteXml

설명

이 메서드는 문서 개체 모델 (DOM)에 대 한 Microsoft 확장입니다.This method is a Microsoft extension to the Document Object Model (DOM). 기능적으로 OuterXml 속성입니다.It is functionally equivalent to the OuterXml property.

XmlDeclaration.Encoding 속성 기록 되는 인코딩을 결정 합니다. 경우는 Encoding 속성에 값이 없는 XmlDocument 인코딩 특성이 없는 기록 됩니다.The XmlDeclaration.Encoding property determines the encoding that is written out. If the Encoding property does not have a value, the XmlDocument is written out without an encoding attribute.

적용 대상