XmlTextWriter.WriteRaw Metoda

Definice

Ručně zapisuje nezpracované značky.

Přetížení

Name Description
WriteRaw(Char[], Int32, Int32)

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

WriteRaw(String)

Ručně zapíše nezpracované značky z řetězce.

Poznámky

Note

Doporučujeme vytvářet XmlWriter instance pomocí XmlWriter.Create metody a XmlWriterSettings třídy, abyste mohli využívat nové funkce.

WriteRaw(Char[], Int32, Int32)

Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs

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 k zápisu.

count
Int32

Počet znaků, které se mají napsat.

Výjimky

buffer je null.

index nebo count je menší než nula.

nebo

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

Poznámky

Note

Doporučujeme vytvářet XmlWriter instance pomocí XmlWriter.Create metody a XmlWriterSettings třídy, abyste mohli využívat nové funkce.

Tato metoda neuvádí řídicí speciální znaky.

Important

Neověřuje XmlTextWriter žá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)

Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs
Zdroj:
XmlTextWriter.cs

Ručně zapíše nezpracované značky 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;
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

Note

Doporučujeme vytvářet XmlWriter instance pomocí XmlWriter.Create metody a XmlWriterSettings třídy, abyste mohli využívat nové funkce.

Tato metoda neuvádí řídicí speciální znaky.

Important

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

Platí pro