XmlEncoder

Namespace: SnowBank.Text.Xml · class

XML Codec

Methods

AppendTo

static StringBuilder AppendTo(StringBuilder sb, string text)

HTML-encodes a character string (& => & , etc...)

  • sb — Buffer where the result is written
  • text — String to encode

AppendXmlEncoded

static StringBuilder AppendXmlEncoded(StringBuilder sb, string text)

Extension method on StringBuilder

Encode

static string Encode(string text)

HTML-encodes a character string (& => & , etc...)

  • text — String to encode

Returns: Encoded string

Optimized version that does not allocate memory if the string is already clean

IsIllegalChar

static bool IsIllegalChar(char c)

IsRestrictedChar

static bool IsRestrictedChar(char c)

WriteTo

static TextWriter WriteTo(TextWriter output, string text)

Fields

AMP

const byte AMP

CLEAN

const byte CLEAN

ENTITY

const byte ENTITY

GT

const byte GT

HIGH_SURROGATE

const byte HIGH_SURROGATE

ILLEGAL

const byte ILLEGAL

LOW_SURROGATE

const byte LOW_SURROGATE

LT

const byte LT

QUOTE

const byte QUOTE