XmlTextWriter.WriteRaw Metoda

Definice

Zapíše nezpracovaný kód ručně.

Přetížení

WriteRaw(Char[], Int32, Int32)

Zapíše nezpracované revize ručně z vyrovnávací paměti znaků.

WriteRaw(String)

Zapíše nezpracovaný kód ručně z řetězce.

Poznámky

Poznámka

Počínaje .NET Framework 2.0 doporučujeme vytvářet XmlWriter instance pomocí XmlWriter.Create metody a XmlWriterSettings třídy, abyste mohli využívat nové funkce.

WriteRaw(Char[], Int32, Int32)

Zapíše nezpracované revize ručně z vyrovnávací paměti znaků.

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)

Parametry

buffer
Char[]

Pole znaků obsahující text k zápisu

index
Int32

Pozice v vyrovnávací paměti označující začátek textu, který se má zapisovat.

count
Int32

Počet znaků k zápisu.

Výjimky

buffer je null.

index nebo count je menší než nula.

-nebo- Délka vyrovnávací paměti je index menší než count.

Poznámky

Poznámka

Počínaje .NET Framework 2.0 doporučujeme vytvářet XmlWriter instance pomocí XmlWriter.Create metody a XmlWriterSettings třídy, abyste mohli využívat nové funkce.

Tato metoda neunikne speciálním znakům.

Důležité

XmlTextWriter Neověřuje žádná data, která jsou předána metoděWriteRaw. Do této metody byste neměli předávat libovolná data.

Platí pro

WriteRaw(String)

Zapíše nezpracovaný kód ručně z řetězce.

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)

Parametry

data
String

Řetězec obsahující text k zápisu

Příklady

Následující příklad zapíše řetězec pomocí WriteRaw metody.

#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

Poznámky

Poznámka

Počínaje .NET Framework 2.0 doporučujeme vytvářet XmlWriter instance pomocí XmlWriter.Create metody a XmlWriterSettings třídy, abyste mohli využívat nové funkce.

Tato metoda neunikne speciálním znakům.

Důležité

XmlTextWriter Neověřuje žádná data, která jsou předána metoděWriteRaw. Do této metody byste neměli předávat libovolná data.

Platí pro