code: 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)) {
              /*
               * Map external entities to the empty string. This is dishonest,
               * but it's consistent with Android's Expat pull parser.
               */
              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('>');
      }
docs: 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">