XmlTextWriter.WriteRaw Metódus

Definíció

A nyers korrektúra manuális írása.

Túlterhelések

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

Kézzel ír nyers korrektúrát egy karakterpufferből.

WriteRaw(String)

Manuálisan ír nyers korrektúrát egy sztringből.

Megjegyzések

Note

Javasoljuk, hogy a XmlWriter metódus és a XmlWriter.Create osztály használatával hozzon létre XmlWriterSettings példányokat az új funkciók előnyeinek kihasználásához.

WriteRaw(Char[], Int32, Int32)

Kézzel ír nyers korrektúrát egy karakterpufferből.

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)

Paraméterek

buffer
Char[]

Az írandó szöveget tartalmazó karaktertömb.

index
Int32

A pufferen belüli pozíció, amely az írandó szöveg kezdetét jelzi.

count
Int32

Az írandó karakterek száma.

Kivételek

buffer az null.

index vagy count kisebb, mint nulla.

-vagy-

A puffer hossza mínusz index kisebb, mint count.

Megjegyzések

Note

Javasoljuk, hogy a XmlWriter metódus és a XmlWriter.Create osztály használatával hozzon létre XmlWriterSettings példányokat az új funkciók előnyeinek kihasználásához.

Ez a metódus nem menekül a speciális karakterek elől.

Important

A XmlTextWriter rendszer nem ellenőrzi a metódusnak WriteRaw átadott adatokat. Nem szabad tetszőleges adatokat átadni ehhez a metódushoz.

A következőre érvényes:

WriteRaw(String)

Manuálisan ír nyers korrektúrát egy sztringből.

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)

Paraméterek

data
String

Az írandó szöveget tartalmazó karakterlánc.

Példák

Az alábbi példa egy sztringet ír a WriteRaw metódus használatával.

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

Megjegyzések

Note

Javasoljuk, hogy a XmlWriter metódus és a XmlWriter.Create osztály használatával hozzon létre XmlWriterSettings példányokat az új funkciók előnyeinek kihasználásához.

Ez a metódus nem menekül a speciális karakterek elől.

Important

A XmlTextWriter rendszer nem ellenőrzi a metódusnak WriteRaw átadott adatokat. Nem szabad tetszőleges adatokat átadni ehhez a metódushoz.

A következőre érvényes: