* xmlParseExternalSubset: * @ctxt: an XML parser context * @ExternalID: the external identifier * @SystemID: the system identifier (or URL) * * parse Markup declarations from an external subset * * [30] extSubset ::= textDecl? extSubsetDecl * * [31] extSubsetDecl ::= (markupdecl | conditionalSect | PEReference | S) * */
| 7248 | * [31] extSubsetDecl ::= (markupdecl | conditionalSect | PEReference | S) * |
| 7249 | */ |
| 7250 | void |
| 7251 | xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, |
| 7252 | const xmlChar *SystemID) { |
| 7253 | int oldInputNr; |
| 7254 | |
| 7255 | xmlCtxtInitializeLate(ctxt); |
| 7256 | |
| 7257 | xmlDetectEncoding(ctxt); |
| 7258 | |
| 7259 | if (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) { |
| 7260 | xmlParseTextDecl(ctxt); |
| 7261 | } |
| 7262 | if (ctxt->myDoc == NULL) { |
| 7263 | ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0"); |
| 7264 | if (ctxt->myDoc == NULL) { |
| 7265 | xmlErrMemory(ctxt); |
| 7266 | return; |
| 7267 | } |
| 7268 | ctxt->myDoc->properties = XML_DOC_INTERNAL; |
| 7269 | } |
| 7270 | if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL) && |
| 7271 | (xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID) == NULL)) { |
| 7272 | xmlErrMemory(ctxt); |
| 7273 | } |
| 7274 | |
| 7275 | ctxt->inSubset = 2; |
| 7276 | oldInputNr = ctxt->inputNr; |
| 7277 | |
| 7278 | SKIP_BLANKS_PE; |
| 7279 | while (((RAW != 0) || (ctxt->inputNr > oldInputNr)) && |
| 7280 | (!PARSER_STOPPED(ctxt))) { |
| 7281 | GROW; |
| 7282 | if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { |
| 7283 | xmlParseConditionalSections(ctxt); |
| 7284 | } else if ((RAW == '<') && ((NXT(1) == '!') || (NXT(1) == '?'))) { |
| 7285 | xmlParseMarkupDecl(ctxt); |
| 7286 | } else { |
| 7287 | xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); |
| 7288 | xmlHaltParser(ctxt); |
| 7289 | return; |
| 7290 | } |
| 7291 | SKIP_BLANKS_PE; |
| 7292 | SHRINK; |
| 7293 | } |
| 7294 | |
| 7295 | while (ctxt->inputNr > oldInputNr) |
| 7296 | xmlPopPE(ctxt); |
| 7297 | |
| 7298 | if (RAW != 0) { |
| 7299 | xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); |
| 7300 | } |
| 7301 | } |
| 7302 | |
| 7303 | /** |
| 7304 | * xmlParseReference: |
no test coverage detected