XmlTextWriter.WriteRaw Método

Definición

Escribe el marcado sin procesar manualmente.

Sobrecargas

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

Escribe el marcado sin procesar manualmente desde un búfer de caracteres.

WriteRaw(String)

Escribe el marcado sin procesar manualmente desde una cadena.

Comentarios

Note

Se recomienda crear XmlWriter instancias mediante el XmlWriter.Create método y la XmlWriterSettings clase para aprovechar las nuevas funcionalidades.

WriteRaw(Char[], Int32, Int32)

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

Escribe el marcado sin procesar manualmente desde un búfer de caracteres.

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)

Parámetros

buffer
Char[]

Matriz de caracteres que contiene el texto que se va a escribir.

index
Int32

Posición dentro del búfer que indica el inicio del texto que se va a escribir.

count
Int32

Número de caracteres que se van a escribir.

Excepciones

buffer es null.

index o count es menor que cero.

O bien

La longitud del búfer menos index es menor que count.

Comentarios

Note

Se recomienda crear XmlWriter instancias mediante el XmlWriter.Create método y la XmlWriterSettings clase para aprovechar las nuevas funcionalidades.

Este método no escapa a caracteres especiales.

Importante

XmlTextWriter no valida ningún dato que se pase al WriteRaw método . No debe pasar datos arbitrarios a este método.

Se aplica a

WriteRaw(String)

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

Escribe el marcado sin procesar manualmente desde una cadena.

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)

Parámetros

data
String

Cadena que contiene el texto que se va a escribir.

Ejemplos

En el ejemplo siguiente se escribe una cadena mediante el WriteRaw método .

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

Comentarios

Note

Se recomienda crear XmlWriter instancias mediante el XmlWriter.Create método y la XmlWriterSettings clase para aprovechar las nuevas funcionalidades.

Este método no escapa a caracteres especiales.

Importante

XmlTextWriter no valida ningún dato que se pase al WriteRaw método . No debe pasar datos arbitrarios a este método.

Se aplica a