@ SuppressWarnings ( "deprecation" ) @ Override public void characters ( char [ ] ch , int start , int length ) throws SAXException { if ( alreadyComplainedAboutThisRun ) { return ; } if ( atStartOfRun ) { char c = ch [ start ] ; if ( pos == 1 ) { // there's a single high surrogate in buf if ( isComposingChar ( UCharacter . getCodePoint ( buf [ 0 ] , c ) ) ) { warn ( "Text run starts with a composing character." ) ; } atStartOfRun = false ; } else { if ( length == 1 && UCharacter . isHighSurrogate ( c ) ) { buf [ 0 ] = c ; pos = 1 ; return ; } else { if ( UCharacter . isHighSurrogate ( c ) ) { if ( isComposingChar ( UCharacter . getCodePoint ( c , ch [ start + 1 ] ) ) ) { warn ( "Text run starts with a composing character." ) ; } } else { if ( isComposingCharOrSurrogate ( c ) ) { warn ( "Text run starts with a composing character." ) ; } } atStartOfRun = false ; } } } int i = start ; int stop = start + length ; if ( pos > 0 ) { // there's stuff in buf while ( i < stop && isComposingCharOrSurrogate ( ch [ i ] ) ) { i ++ ; } appendToBuf ( ch , start , i ) ; if ( i == stop ) { return ; } else { if ( ! Normalizer . isNormalized ( buf , 0 , pos , Normalizer . NFC , 0 ) ) { errAboutTextRun ( ) ; } pos = 0 ; } } if ( i < stop ) { start = i ; i = stop - 1 ; while ( i > start && isComposingCharOrSurrogate ( ch [ i ] ) ) { i -- ; } if ( i > start && ! Normalizer . isNormalized ( ch , start , i , Normalizer . NFC , 0 ) ) { errAboutTextRun ( ) ; } appendToBuf ( ch , i , stop ) ; } }
In the normal mode this method has the usual SAX semantics . In the source text mode this method is used for reporting the source text .