protected void skipInternalSubset ( ) throws XMLStreamException { while ( true ) { int i = getNextAfterWS ( ) ; if ( i < 0 ) { // Error for internal subset throwUnexpectedEOF ( SUFFIX_IN_DTD_INTERNAL ) ; } if ( i == ' ' ) { // parameter entity skipPE ( ) ; continue ; } if ( i == ' ' ) { /* Let's determine type here, and call appropriate skip * methods. */ char c = getNextSkippingPEs ( ) ; if ( c == ' ' ) { // xml decl? /* Not sure if PIs are really allowed in DTDs, but let's * just allow them until proven otherwise. XML declaration * is legal in the beginning, anyhow */ skipPI ( ) ; } else if ( c == ' ' ) { // ignore/include, comment, declaration? c = getNextSkippingPEs ( ) ; if ( c == ' ' ) { /* Shouldn't really get these, as they are not allowed * in the internal subset? So let's just leave it * as is, and see what happens. :-) */ ; } else if ( c == ' ' ) { // plain comment skipComment ( ) ; } else if ( c >= ' ' && c <= ' ' ) { skipDeclaration ( c ) ; } else { /* Hmmh, let's not care too much; but we need to try * to match the closing gt-char nonetheless? */ skipDeclaration ( c ) ; } } else { /* Shouldn't fail (since we are to completely ignore * subset); let's just push it back and continue. */ -- mInputPtr ; } continue ; } if ( i == ' ' ) { // Int. subset has no conditional sections, has to be the end... /* 18-Jul-2004, TSa: Let's just make sure it happened * in the main input source, not at external entity... */ if ( mInput != mRootInput ) { throwParseError ( "Encountered int. subset end marker ']]>' in an expanded entity; has to be at main level." ) ; } // End of internal subset break ; } throwUnexpectedChar ( i , SUFFIX_IN_DTD_INTERNAL + "; expected a '<' to start a directive, or \"]>\" to end internal subset." ) ; } }
Method that will skip through internal DTD subset without doing any parsing except for trying to match end of subset properly .