code: private void parseMarkupdecl() throws Exception {
          char[] saved = null;
          boolean savedPE = expandPE;
  
          // prevent "<%foo;" and ensures saved entity is right
          require('<');
          unread('<');
          expandPE = false;
  
          if (tryRead("<!ELEMENT")) {
              saved = readBuffer;
              expandPE = savedPE;
              parseElementDecl();
          } else if (tryRead("<!ATTLIST")) {
              saved = readBuffer;
              expandPE = savedPE;
              parseAttlistDecl();
          } else if (tryRead("<!ENTITY")) {
              saved = readBuffer;
              expandPE = savedPE;
              parseEntityDecl();
          } else if (tryRead("<!NOTATION")) {
              saved = readBuffer;
              expandPE = savedPE;
              parseNotationDecl();
          } else if (tryRead(startDelimPI)) {
              saved = readBuffer;
              expandPE = savedPE;
              parsePI();
          } else if (tryRead(startDelimComment)) {
              saved = readBuffer;
              expandPE = savedPE;
              parseComment();
          } else if (tryRead("<![")) {
              saved = readBuffer;
              expandPE = savedPE;
              if (inputStack.size() > 0) {
                  parseConditionalSect(saved);
              } else {
                  fatal("conditional sections illegal in internal subset");
              }
          } else {
              fatal("expected markup declaration");
          }
  
          // VC: Proper Decl/PE Nesting
          if (readBuffer != saved) {
              handler.verror("Illegal Declaration/PE nesting");
          }
      }
docs: Parse a markup declaration in the internal or external DTD subset.
  
  <pre>
  [29] markupdecl ::= elementdecl | Attlistdecl | EntityDecl
  | NotationDecl | PI | Comment
  [30] extSubsetDecl ::= (markupdecl | conditionalSect
  | PEReference | S) *
  </pre>
  
  <p>
  Reading toplevel PE references is handled as a lexical issue by the
  caller, as is whitespace.