Share via


XmlTextWriter.WriteRaw Yöntem

Tanım

Ham işaretlemeyi el ile yazar.

Aşırı Yüklemeler

WriteRaw(Char[], Int32, Int32)

Ham işaretlemeyi bir karakter arabelleğinden el ile yazar.

WriteRaw(String)

Ham işaretlemeyi bir dizeden el ile yazar.

Açıklamalar

Not

.NET Framework 2.0'dan başlayarak, yeni işlevlerden yararlanmak için yöntemini ve XmlWriterSettings sınıfını XmlWriter.Create kullanarak örnekler oluşturmanızı XmlWriter öneririz.

WriteRaw(Char[], Int32, Int32)

Source:
XmlTextWriter.cs
Source:
XmlTextWriter.cs
Source:
XmlTextWriter.cs

Ham işaretlemeyi bir karakter arabelleğinden el ile yazar.

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)

Parametreler

buffer
Char[]

Yazacak metni içeren karakter dizisi.

index
Int32

Yazacak metnin başlangıcını gösteren arabellek içindeki konum.

count
Int32

Yazılacak karakter sayısı.

Özel durumlar

buffer, null değeridir.

index veya count sıfırdan küçüktür.

-veya-

Arabellek uzunluğu eksi index değeri değerinden countküçük.

Açıklamalar

Not

.NET Framework 2.0'dan başlayarak, yeni işlevlerden yararlanmak için yöntemini ve XmlWriterSettings sınıfını XmlWriter.Create kullanarak örnekler oluşturmanızı XmlWriter öneririz.

Bu yöntem özel karakterlerden kaçmaz.

Önemli

XmlTextWriter yöntemine WriteRaw geçirilen verileri doğrulamaz. Bu yönteme rastgele veriler geçirmemelisiniz.

Şunlara uygulanır

WriteRaw(String)

Source:
XmlTextWriter.cs
Source:
XmlTextWriter.cs
Source:
XmlTextWriter.cs

Ham işaretlemeyi bir dizeden el ile yazar.

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)

Parametreler

data
String

Yazacak metni içeren dize.

Örnekler

Aşağıdaki örnek yöntemini kullanarak WriteRaw bir dize yazar.

#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

Açıklamalar

Not

.NET Framework 2.0'dan başlayarak, yeni işlevlerden yararlanmak için yöntemini ve XmlWriterSettings sınıfını XmlWriter.Create kullanarak örnekler oluşturmanızı XmlWriter öneririz.

Bu yöntem özel karakterlerden kaçmaz.

Önemli

XmlTextWriter yöntemine WriteRaw geçirilen verileri doğrulamaz. Bu yönteme rastgele veriler geçirmemelisiniz.

Şunlara uygulanır