XmlTextWriter.WriteRaw 메서드

정의

원시 태그를 직접 작성합니다.

오버로드

WriteRaw(Char[], Int32, Int32)

문자 버퍼에서 직접 원시 태그를 작성합니다.

WriteRaw(String)

문자열에서 직접 원시 태그를 작성합니다.

설명

참고

.NET Framework 2.0부터 메서드와 XmlWriterSettings 클래스를 사용하여 XmlWriter.Create 인스턴스를 만들어 XmlWriter 새 기능을 활용하는 것이 좋습니다.

WriteRaw(Char[], Int32, Int32)

문자 버퍼에서 직접 원시 태그를 작성합니다.

public:
 override void WriteRaw(cli::array <char> ^ buffer, int index, int count);
public override void WriteRaw (char[] buffer, int index, int count);
override this.WriteRaw : char[] * int * int -> unit
Public Overrides Sub WriteRaw (buffer As Char(), index As Integer, count As Integer)

매개 변수

buffer
Char[]

쓸 텍스트가 포함된 문자 배열입니다.

index
Int32

쓸 텍스트의 시작을 나타내는 버퍼 내의 위치입니다.

count
Int32

쓸 문자 수입니다.

예외

buffer이(가) null인 경우

index 또는 count가 0보다 작습니다.

또는 버퍼 길이에서 index를 빼면 count보다 작습니다.

설명

참고

.NET Framework 2.0부터 메서드와 XmlWriterSettings 클래스를 사용하여 XmlWriter.Create 인스턴스를 만들어 XmlWriter 새 기능을 활용하는 것이 좋습니다.

이 메서드는 특수 문자를 이스케이프하지 않습니다.

중요

메서드에 XmlTextWriter 전달되는 WriteRaw 데이터의 유효성을 검사하지 않습니다. 임의의 데이터를 이 메서드에 전달하면 안 됩니다.

적용 대상

WriteRaw(String)

문자열에서 직접 원시 태그를 작성합니다.

public:
 override void WriteRaw(System::String ^ data);
public override void WriteRaw (string data);
override this.WriteRaw : string -> unit
Public Overrides Sub WriteRaw (data As String)

매개 변수

data
String

작성할 텍스트를 포함하는 문자열입니다.

예제

다음 예제에서는 메서드를 사용하여 문자열을 WriteRaw 씁니다.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   
   // Create a writer that outputs to the console.
   XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
   writer->Formatting = Formatting::Indented;
   
   // Write the root element.
   writer->WriteStartElement( "Items" );
   
   // Write a string using WriteRaw. Note that the special
   // characters are not escaped.
   writer->WriteStartElement( "Item" );
   writer->WriteString( "Write unescaped text:  " );
   writer->WriteRaw( "this & that" );
   writer->WriteEndElement();
   
   // Write the same string using WriteString. Note that the 
   // special characters are escaped.
   writer->WriteStartElement( "Item" );
   writer->WriteString( "Write the same string using WriteString:  " );
   writer->WriteString( "this & that" );
   writer->WriteEndElement();
   
   // Write the close tag for the root element.
   writer->WriteEndElement();
   
   // Write the XML to file and close the writer.
   writer->Close();
}
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
     // Create a writer that outputs to the console.
     XmlTextWriter writer = new XmlTextWriter (Console.Out);
     writer.Formatting = Formatting.Indented;

     // Write the root element.
     writer.WriteStartElement("Items");

     // Write a string using WriteRaw. Note that the special
     // characters are not escaped.
     writer.WriteStartElement("Item");
     writer.WriteString("Write unescaped text:  ");
     writer.WriteRaw("this & that");
     writer.WriteEndElement();

     // Write the same string using WriteString. Note that the
     // special characters are escaped.
     writer.WriteStartElement("Item");
     writer.WriteString("Write the same string using WriteString:  ");
     writer.WriteString("this & that");
     writer.WriteEndElement();

     // Write the close tag for the root element.
     writer.WriteEndElement();

     // Write the XML to file and close the writer.
     writer.Close();
  }
}
Option Strict
Option Explicit

Imports System.IO
Imports System.Xml

Public Class Sample
    
    Public Shared Sub Main()
        ' Create a writer that outputs to the console.
        Dim writer As New XmlTextWriter(Console.Out)
        writer.Formatting = Formatting.Indented
        
        ' Write the root element.
        writer.WriteStartElement("Items")
        
        ' Write a string using WriteRaw. Note that the special
        ' characters are not escaped.
        writer.WriteStartElement("Item")
        writer.WriteString("Write unescaped text:  ")
        writer.WriteRaw("this & that")
        writer.WriteEndElement()
        
        ' Write the same string using WriteString. Note that the 
        ' special characters are escaped.
        writer.WriteStartElement("Item")
        writer.WriteString("Write the same string using WriteString:  ")
        writer.WriteString("this & that")
        writer.WriteEndElement()
        
        ' Write the close tag for the root element.
        writer.WriteEndElement()
        
        ' Write the XML to file and close the writer.
        writer.Close()
    End Sub
End Class

설명

참고

.NET Framework 2.0부터 메서드와 XmlWriterSettings 클래스를 사용하여 XmlWriter.Create 인스턴스를 만들어 XmlWriter 새 기능을 활용하는 것이 좋습니다.

이 메서드는 특수 문자를 이스케이프하지 않습니다.

중요

메서드에 XmlTextWriter 전달되는 WriteRaw 데이터의 유효성을 검사하지 않습니다. 임의의 데이터를 이 메서드에 전달하면 안 됩니다.

적용 대상