Udostępnij za pośrednictwem


ValidatorHandler.Characters(Char[], Int32, Int32) Method

Definition

Receive notification of character data.

[Android.Runtime.Register("characters", "([CII)V", "GetCharacters_arrayCIIHandler")]
public abstract void Characters (char[]? ch, int start, int length);
[<Android.Runtime.Register("characters", "([CII)V", "GetCharacters_arrayCIIHandler")>]
abstract member Characters : char[] * int * int -> unit

Parameters

ch
Char[]

the characters from the XML document

start
Int32

the start position in the array

length
Int32

the number of characters to read from the array

Implements

Attributes

Remarks

Receive notification of character data.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Individual characters may consist of more than one Java char value. There are two important cases where this happens, because characters can't be represented in just sixteen bits. In one case, characters are represented in a <em>Surrogate Pair</em>, using two special Unicode values. Such characters are in the so-called "Astral Planes", with a code point above U+FFFF. A second case involves composite characters, such as a base character combining with one or more accent characters.

Your code should not assume that algorithms using char-at-a-time idioms will be working in character units; in some cases they will split characters. This is relevant wherever XML permits arbitrary characters, such as attribute values, processing instruction data, and comments as well as in data reported from this method. It's also generally relevant whenever Java code manipulates internationalized text; the issue isn't unique to XML.

Note that some parsers will report whitespace in element content using the #ignorableWhitespace ignorableWhitespace method rather than this one (validating parsers <em>must</em> do so).

Java documentation for org.xml.sax.ContentHandler.characters(char[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to