question: protected final void scanEntityValue ( XMLString value , XMLString nonNormalizedValue ) throws IOException , XNIException { int quote = fEntityScanner . scanChar ( ) ; if ( quote != '\'' && quote != '"' ) { reportFatalError ( "OpenQuoteMissingInDecl" , null ) ; } int entityDepth = fEntityDepth ; XMLString literal = fString ; XMLString literal2 = fString ; if ( fEntityScanner . scanLiteral ( quote , fString ) != quote ) { fStringBuffer . clear ( ) ; fStringBuffer2 . clear ( ) ; do { fStringBuffer . append ( fString ) ; fStringBuffer2 . append ( fString ) ; if ( fEntityScanner . skipChar ( '&' ) ) { if ( fEntityScanner . skipChar ( '#' ) ) { fStringBuffer2 . append ( "&#" ) ; scanCharReferenceValue ( fStringBuffer , fStringBuffer2 ) ; } else { fStringBuffer . append ( '&' ) ; fStringBuffer2 . append ( '&' ) ; String eName = fEntityScanner . scanName ( ) ; if ( eName == null ) { reportFatalError ( "NameRequiredInReference" , null ) ; } else { fStringBuffer . append ( eName ) ; fStringBuffer2 . append ( eName ) ; } if ( ! fEntityScanner . skipChar ( ';' ) ) { reportFatalError ( "SemicolonRequiredInReference" , new Object [ ] { eName } ) ; } else { fStringBuffer . append ( ';' ) ; fStringBuffer2 . append ( ';' ) ; } } } else if ( fEntityScanner . skipChar ( '%' ) ) { while ( true ) { fStringBuffer2 . append ( '%' ) ; String peName = fEntityScanner . scanName ( ) ; if ( peName == null ) { reportFatalError ( "NameRequiredInPEReference" , null ) ; } else if ( ! fEntityScanner . skipChar ( ';' ) ) { reportFatalError ( "SemicolonRequiredInPEReference" , new Object [ ] { peName } ) ; } else { if ( scanningInternalSubset ( ) ) { reportFatalError ( "PEReferenceWithinMarkup" , new Object [ ] { peName } ) ; } fStringBuffer2 . append ( peName ) ; fStringBuffer2 . append ( ';' ) ; } startPE ( peName , true ) ; fEntityScanner . skipSpaces ( ) ; if ( ! fEntityScanner . skipChar ( '%' ) ) break ; } } else { int c = fEntityScanner . peekChar ( ) ; if ( XMLChar . isHighSurrogate ( c ) ) { scanSurrogates ( fStringBuffer2 ) ; } else if ( isInvalidLiteral ( c ) ) { reportFatalError ( "InvalidCharInLiteral" , new Object [ ] { Integer . toHexString ( c ) } ) ; fEntityScanner . scanChar ( ) ; } else if ( c != quote || entityDepth != fEntityDepth ) { fStringBuffer . append ( ( char ) c ) ; fStringBuffer2 . append ( ( char ) c ) ; fEntityScanner . scanChar ( ) ; } } } while ( fEntityScanner . scanLiteral ( quote , fString ) != quote ) ; fStringBuffer . append ( fString ) ; fStringBuffer2 . append ( fString ) ; literal = fStringBuffer ; literal2 = fStringBuffer2 ; } value . setValues ( literal ) ; nonNormalizedValue . setValues ( literal2 ) ; if ( ! fEntityScanner . skipChar ( quote ) ) { reportFatalError ( "CloseQuoteMissingInDecl" , null ) ; } }
target:  Scans an entity value.