question: private void readEntityDeclaration ( ) throws IOException , XmlPullParserException { read ( START_ENTITY ) ; boolean generalEntity = true ; skip ( ) ; if ( peekCharacter ( ) == '%' ) { generalEntity = false ; position ++ ; skip ( ) ; } String name = readName ( ) ; skip ( ) ; int quote = peekCharacter ( ) ; String entityValue ; if ( quote == '"' || quote == '\'' ) { position ++ ; entityValue = readValue ( ( char ) quote , true , false , ValueContext . ENTITY_DECLARATION ) ; if ( peekCharacter ( ) == quote ) { position ++ ; } } else if ( readExternalId ( true , false ) ) { entityValue = "" ; skip ( ) ; if ( peekCharacter ( ) == NDATA [ 0 ] ) { read ( NDATA ) ; skip ( ) ; readName ( ) ; } } else { throw new XmlPullParserException ( "Expected entity value or external ID" , this , null ) ; } if ( generalEntity && processDocDecl ) { if ( documentEntities == null ) { documentEntities = new HashMap < String , char [ ] > ( ) ; } documentEntities . put ( name , entityValue . toCharArray ( ) ) ; } skip ( ) ; read ( '>' ) ; }
target:  Read an entity declaration. The value of internal entities are inline: <!ENTITY foo "bar"> The values of external entities must be retrieved by URL or path: <!ENTITY foo SYSTEM "http://host/file"> <!ENTITY foo PUBLIC "-//Android//Foo//EN" "http://host/file"> <!ENTITY foo SYSTEM "../file.png" NDATA png> Entities may be general or parameterized. Parameterized entities are marked by a percent sign. Such entities may only be used in the DTD: <!ENTITY % foo "bar">