WriteSurrogateCharEntity Method

XmlTextWriter.WriteSurrogateCharEntity Method

Generates and writes the surrogate character entity for the surrogate character pair.

Namespace: System.Xml
Assembly: System.Xml (in system.xml.dll)

public override void WriteSurrogateCharEntity (
	char lowChar,
	char highChar
)
public void WriteSurrogateCharEntity (
	char lowChar, 
	char highChar
)
public override function WriteSurrogateCharEntity (
	lowChar : char, 
	highChar : char
)
Not applicable.

Parameters

lowChar

The low surrogate. This must be a value between 0xDC00 and 0xDFFF.

highChar

The high surrogate. This must be a value between 0xD800 and 0xDBFF.

Exception typeCondition

Exception

An invalid surrogate character pair was passed.

NoteNote:

In the Microsoft .NET Framework version 2.0 release, the recommended practice is to create XmlWriter instances using the System.Xml.XmlWriter.Create method and the XmlWriterSettings class. This allows you to take full advantage of all the new features introduced in this release. For more information, see Creating XML Writers.

This method is only applicable on systems that use UTF-16 encoding.

The surrogate character entity is written in hexadecimal format. The range for surrogate characters is #x10000 to #x10FFFF. The following formula is used to generate the surrogate character entity: (highChar - 0xD800) * 0x400 + (lowChar - 0xDC00) + 0x10000.

For both HTML and XML, the document character set (and therefore the notation of numeric character references) is based on UCS [ISO-10646]. A single numeric character reference in a source document may therefore in some cases correspond to two 16-bit units in a string (a high surrogate and a low surrogate). These 16-bit units are referred to as a surrogate pair.

For more information regarding surrogates or characters, refer to section 3.7 of the Unicode 3.0/Unicode 2.0 standard located at http://www.unicode.org, or section 2.2 of the W3C XML 1.0 Recommendation located at http://www.w3.org/TR/REC-xml#charsets.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2016 Microsoft