| 8208 | */ |
| 8209 | |
| 8210 | static void |
| 8211 | xmlParseInternalSubset(xmlParserCtxtPtr ctxt) { |
| 8212 | /* |
| 8213 | * Is there any DTD definition ? |
| 8214 | */ |
| 8215 | if (RAW == '[') { |
| 8216 | int oldInputNr = ctxt->inputNr; |
| 8217 | |
| 8218 | NEXT; |
| 8219 | /* |
| 8220 | * Parse the succession of Markup declarations and |
| 8221 | * PEReferences. |
| 8222 | * Subsequence (markupdecl | PEReference | S)* |
| 8223 | */ |
| 8224 | SKIP_BLANKS; |
| 8225 | while (((RAW != ']') || (ctxt->inputNr > oldInputNr)) && |
| 8226 | (PARSER_STOPPED(ctxt) == 0)) { |
| 8227 | |
| 8228 | /* |
| 8229 | * Conditional sections are allowed from external entities included |
| 8230 | * by PE References in the internal subset. |
| 8231 | */ |
| 8232 | if ((PARSER_EXTERNAL(ctxt)) && |
| 8233 | (RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { |
| 8234 | xmlParseConditionalSections(ctxt); |
| 8235 | } else if ((RAW == '<') && ((NXT(1) == '!') || (NXT(1) == '?'))) { |
| 8236 | xmlParseMarkupDecl(ctxt); |
| 8237 | } else if (RAW == '%') { |
| 8238 | xmlParsePEReference(ctxt); |
| 8239 | } else { |
| 8240 | xmlFatalErr(ctxt, XML_ERR_INT_SUBSET_NOT_FINISHED, NULL); |
| 8241 | break; |
| 8242 | } |
| 8243 | SKIP_BLANKS_PE; |
| 8244 | SHRINK; |
| 8245 | GROW; |
| 8246 | } |
| 8247 | |
| 8248 | while (ctxt->inputNr > oldInputNr) |
| 8249 | xmlPopPE(ctxt); |
| 8250 | |
| 8251 | if (RAW == ']') { |
| 8252 | NEXT; |
| 8253 | SKIP_BLANKS; |
| 8254 | } |
| 8255 | } |
| 8256 | |
| 8257 | /* |
| 8258 | * We should be at the end of the DOCTYPE declaration. |
| 8259 | */ |
| 8260 | if ((ctxt->wellFormed) && (RAW != '>')) { |
| 8261 | xmlFatalErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED, NULL); |
| 8262 | return; |
| 8263 | } |
| 8264 | NEXT; |
| 8265 | } |
| 8266 | |
| 8267 | #ifdef LIBXML_SAX1_ENABLED |
no test coverage detected