private void readDoctype(boolean saveDtdText) throws IOException, XmlPullParserException {
  read(START_DOCTYPE);
  int startPosition=-1;
  if (saveDtdText) {
    bufferCapture=new StringBuilder();
    startPosition=position;
  }
  try {
    skip();
    rootElementName=readName();
    readExternalId(true,true);
    skip();
    if (peekCharacter() == '[') {
      readInternalSubset();
    }
    skip();
  }
  finally {
    if (saveDtdText) {
      bufferCapture.append(buffer,0,position);
      bufferCapture.delete(0,startPosition);
      text=bufferCapture.toString();
      bufferCapture=null;
    }
  }
  read('>');
}

private void readDoctype ( boolean saveDtdText ) throws IOException , XmlPullParserException { read ( START_DOCTYPE ) ; int startPosition = - 1 ; if ( saveDtdText ) { bufferCapture = new StringBuilder ( ) ; startPosition = position ; } try { skip ( ) ; rootElementName = readName ( ) ; readExternalId ( true , true ) ; skip ( ) ; if ( peekCharacter ( ) == '[' ) { readInternalSubset ( ) ; } skip ( ) ; } finally { if ( saveDtdText ) { bufferCapture . append ( buffer , 0 , position ) ; bufferCapture . delete ( 0 , startPosition ) ; text = bufferCapture . toString ( ) ; bufferCapture = null ; } } read ( '>' ) ; }
read the document ' s dtd . although this parser is non - validating , the dtd must be parsed to capture entity values and default attribute values .
