• Home
  • Raw
  • Download

Lines Matching refs:ctxt

56 xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
58 static void htmlParseComment(htmlParserCtxtPtr ctxt);
74 htmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra) in htmlErrMemory() argument
76 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in htmlErrMemory()
77 (ctxt->instate == XML_PARSER_EOF)) in htmlErrMemory()
79 if (ctxt != NULL) { in htmlErrMemory()
80 ctxt->errNo = XML_ERR_NO_MEMORY; in htmlErrMemory()
81 ctxt->instate = XML_PARSER_EOF; in htmlErrMemory()
82 ctxt->disableSAX = 1; in htmlErrMemory()
85 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, in htmlErrMemory()
90 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, in htmlErrMemory()
106 htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, in htmlParseErr() argument
109 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in htmlParseErr()
110 (ctxt->instate == XML_PARSER_EOF)) in htmlParseErr()
112 if (ctxt != NULL) in htmlParseErr()
113 ctxt->errNo = error; in htmlParseErr()
114 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, in htmlParseErr()
119 if (ctxt != NULL) in htmlParseErr()
120 ctxt->wellFormed = 0; in htmlParseErr()
133 htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, in htmlParseErrInt() argument
136 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in htmlParseErrInt()
137 (ctxt->instate == XML_PARSER_EOF)) in htmlParseErrInt()
139 if (ctxt != NULL) in htmlParseErrInt()
140 ctxt->errNo = error; in htmlParseErrInt()
141 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, in htmlParseErrInt()
144 if (ctxt != NULL) in htmlParseErrInt()
145 ctxt->wellFormed = 0; in htmlParseErrInt()
164 htmlnamePush(htmlParserCtxtPtr ctxt, const xmlChar * value) in htmlnamePush() argument
166 if ((ctxt->html < 3) && (xmlStrEqual(value, BAD_CAST "head"))) in htmlnamePush()
167 ctxt->html = 3; in htmlnamePush()
168 if ((ctxt->html < 10) && (xmlStrEqual(value, BAD_CAST "body"))) in htmlnamePush()
169 ctxt->html = 10; in htmlnamePush()
170 if (ctxt->nameNr >= ctxt->nameMax) { in htmlnamePush()
171 ctxt->nameMax *= 2; in htmlnamePush()
172 ctxt->nameTab = (const xmlChar * *) in htmlnamePush()
173 xmlRealloc((xmlChar * *)ctxt->nameTab, in htmlnamePush()
174 ctxt->nameMax * in htmlnamePush()
175 sizeof(ctxt->nameTab[0])); in htmlnamePush()
176 if (ctxt->nameTab == NULL) { in htmlnamePush()
177 htmlErrMemory(ctxt, NULL); in htmlnamePush()
181 ctxt->nameTab[ctxt->nameNr] = value; in htmlnamePush()
182 ctxt->name = value; in htmlnamePush()
183 return (ctxt->nameNr++); in htmlnamePush()
194 htmlnamePop(htmlParserCtxtPtr ctxt) in htmlnamePop() argument
198 if (ctxt->nameNr <= 0) in htmlnamePop()
200 ctxt->nameNr--; in htmlnamePop()
201 if (ctxt->nameNr < 0) in htmlnamePop()
203 if (ctxt->nameNr > 0) in htmlnamePop()
204 ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; in htmlnamePop()
206 ctxt->name = NULL; in htmlnamePop()
207 ret = ctxt->nameTab[ctxt->nameNr]; in htmlnamePop()
208 ctxt->nameTab[ctxt->nameNr] = NULL; in htmlnamePop()
222 htmlNodeInfoPush(htmlParserCtxtPtr ctxt, htmlParserNodeInfo *value) in htmlNodeInfoPush() argument
224 if (ctxt->nodeInfoNr >= ctxt->nodeInfoMax) { in htmlNodeInfoPush()
225 if (ctxt->nodeInfoMax == 0) in htmlNodeInfoPush()
226 ctxt->nodeInfoMax = 5; in htmlNodeInfoPush()
227 ctxt->nodeInfoMax *= 2; in htmlNodeInfoPush()
228 ctxt->nodeInfoTab = (htmlParserNodeInfo *) in htmlNodeInfoPush()
229 xmlRealloc((htmlParserNodeInfo *)ctxt->nodeInfoTab, in htmlNodeInfoPush()
230 ctxt->nodeInfoMax * in htmlNodeInfoPush()
231 sizeof(ctxt->nodeInfoTab[0])); in htmlNodeInfoPush()
232 if (ctxt->nodeInfoTab == NULL) { in htmlNodeInfoPush()
233 htmlErrMemory(ctxt, NULL); in htmlNodeInfoPush()
237 ctxt->nodeInfoTab[ctxt->nodeInfoNr] = *value; in htmlNodeInfoPush()
238 ctxt->nodeInfo = &ctxt->nodeInfoTab[ctxt->nodeInfoNr]; in htmlNodeInfoPush()
239 return (ctxt->nodeInfoNr++); in htmlNodeInfoPush()
251 htmlNodeInfoPop(htmlParserCtxtPtr ctxt) in htmlNodeInfoPop() argument
253 if (ctxt->nodeInfoNr <= 0) in htmlNodeInfoPop()
255 ctxt->nodeInfoNr--; in htmlNodeInfoPop()
256 if (ctxt->nodeInfoNr < 0) in htmlNodeInfoPop()
258 if (ctxt->nodeInfoNr > 0) in htmlNodeInfoPop()
259 ctxt->nodeInfo = &ctxt->nodeInfoTab[ctxt->nodeInfoNr - 1]; in htmlNodeInfoPop()
261 ctxt->nodeInfo = NULL; in htmlNodeInfoPop()
262 return &ctxt->nodeInfoTab[ctxt->nodeInfoNr]; in htmlNodeInfoPop()
294 #define UPPER (toupper(*ctxt->input->cur))
296 #define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val)
298 #define NXT(val) ctxt->input->cur[(val)]
300 #define UPP(val) (toupper(ctxt->input->cur[(val)]))
302 #define CUR_PTR ctxt->input->cur
304 #define SHRINK if ((ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
305 (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
306 xmlParserInputShrink(ctxt->input)
308 #define GROW if ((ctxt->progressive == 0) && \
309 (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \
310 xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
312 #define CURRENT ((int) (*ctxt->input->cur))
314 #define SKIP_BLANKS htmlSkipBlankChars(ctxt)
319 #define CUR ((int) (*ctxt->input->cur))
320 #define NEXT xmlNextChar(ctxt)
322 #define RAW (ctxt->token ? -1 : (*ctxt->input->cur))
326 if (*(ctxt->input->cur) == '\n') { \
327 ctxt->input->line++; ctxt->input->col = 1; \
328 } else ctxt->input->col++; \
329 ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \
338 #define CUR_CHAR(l) htmlCurrentChar(ctxt, &l)
339 #define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
360 htmlFindEncoding(xmlParserCtxtPtr ctxt) { in htmlFindEncoding() argument
363 if ((ctxt == NULL) || (ctxt->input == NULL) || in htmlFindEncoding()
364 (ctxt->input->encoding != NULL) || (ctxt->input->buf == NULL) || in htmlFindEncoding()
365 (ctxt->input->buf->encoder != NULL)) in htmlFindEncoding()
367 if ((ctxt->input->cur == NULL) || (ctxt->input->end == NULL)) in htmlFindEncoding()
370 start = ctxt->input->cur; in htmlFindEncoding()
371 end = ctxt->input->end; in htmlFindEncoding()
412 htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { in htmlCurrentChar() argument
413 if (ctxt->instate == XML_PARSER_EOF) in htmlCurrentChar()
416 if (ctxt->token != 0) { in htmlCurrentChar()
418 return(ctxt->token); in htmlCurrentChar()
420 if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { in htmlCurrentChar()
432 const unsigned char *cur = ctxt->input->cur; in htmlCurrentChar()
439 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in htmlCurrentChar()
440 cur = ctxt->input->cur; in htmlCurrentChar()
447 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in htmlCurrentChar()
448 cur = ctxt->input->cur; in htmlCurrentChar()
454 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in htmlCurrentChar()
455 cur = ctxt->input->cur; in htmlCurrentChar()
480 htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, in htmlCurrentChar()
485 if ((*ctxt->input->cur == 0) && in htmlCurrentChar()
486 (ctxt->input->cur < ctxt->input->end)) { in htmlCurrentChar()
487 htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, in htmlCurrentChar()
494 return((int) *ctxt->input->cur); in htmlCurrentChar()
503 if ((int) *ctxt->input->cur < 0x80) in htmlCurrentChar()
504 return((int) *ctxt->input->cur); in htmlCurrentChar()
513 guess = htmlFindEncoding(ctxt); in htmlCurrentChar()
515 xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1); in htmlCurrentChar()
517 if (ctxt->input->encoding != NULL) in htmlCurrentChar()
518 xmlFree((xmlChar *) ctxt->input->encoding); in htmlCurrentChar()
519 ctxt->input->encoding = guess; in htmlCurrentChar()
522 xmlSwitchToEncoding(ctxt, handler); in htmlCurrentChar()
524 htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, in htmlCurrentChar()
528 ctxt->charset = XML_CHAR_ENCODING_UTF8; in htmlCurrentChar()
531 return(xmlCurrentChar(ctxt, len)); in htmlCurrentChar()
544 if (ctxt->input->end - ctxt->input->cur >= 4) { in htmlCurrentChar()
546 ctxt->input->cur[0], ctxt->input->cur[1], in htmlCurrentChar()
547 ctxt->input->cur[2], ctxt->input->cur[3]); in htmlCurrentChar()
549 snprintf(buffer, 149, "Bytes: 0x%02X\n", ctxt->input->cur[0]); in htmlCurrentChar()
551 htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, in htmlCurrentChar()
556 ctxt->charset = XML_CHAR_ENCODING_8859_1; in htmlCurrentChar()
558 return((int) *ctxt->input->cur); in htmlCurrentChar()
571 htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { in htmlSkipBlankChars() argument
574 while (IS_BLANK_CH(*(ctxt->input->cur))) { in htmlSkipBlankChars()
575 if ((*ctxt->input->cur == 0) && in htmlSkipBlankChars()
576 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { in htmlSkipBlankChars()
577 xmlPopInput(ctxt); in htmlSkipBlankChars()
579 if (*(ctxt->input->cur) == '\n') { in htmlSkipBlankChars()
580 ctxt->input->line++; ctxt->input->col = 1; in htmlSkipBlankChars()
581 } else ctxt->input->col++; in htmlSkipBlankChars()
582 ctxt->input->cur++; in htmlSkipBlankChars()
583 ctxt->nbChars++; in htmlSkipBlankChars()
584 if (*ctxt->input->cur == 0) in htmlSkipBlankChars()
585 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in htmlSkipBlankChars()
1292 htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag) in htmlAutoCloseOnClose() argument
1299 for (i = (ctxt->nameNr - 1); i >= 0; i--) { in htmlAutoCloseOnClose()
1301 if (xmlStrEqual(newtag, ctxt->nameTab[i])) in htmlAutoCloseOnClose()
1309 if (htmlGetEndPriority(ctxt->nameTab[i]) > priority) in htmlAutoCloseOnClose()
1315 while (!xmlStrEqual(newtag, ctxt->name)) { in htmlAutoCloseOnClose()
1316 info = htmlTagLookup(ctxt->name); in htmlAutoCloseOnClose()
1318 htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, in htmlAutoCloseOnClose()
1320 newtag, ctxt->name); in htmlAutoCloseOnClose()
1322 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlAutoCloseOnClose()
1323 ctxt->sax->endElement(ctxt->userData, ctxt->name); in htmlAutoCloseOnClose()
1324 htmlnamePop(ctxt); in htmlAutoCloseOnClose()
1335 htmlAutoCloseOnEnd(htmlParserCtxtPtr ctxt) in htmlAutoCloseOnEnd() argument
1339 if (ctxt->nameNr == 0) in htmlAutoCloseOnEnd()
1341 for (i = (ctxt->nameNr - 1); i >= 0; i--) { in htmlAutoCloseOnEnd()
1342 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlAutoCloseOnEnd()
1343 ctxt->sax->endElement(ctxt->userData, ctxt->name); in htmlAutoCloseOnEnd()
1344 htmlnamePop(ctxt); in htmlAutoCloseOnEnd()
1361 htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag) in htmlAutoClose() argument
1363 while ((newtag != NULL) && (ctxt->name != NULL) && in htmlAutoClose()
1364 (htmlCheckAutoClose(newtag, ctxt->name))) { in htmlAutoClose()
1365 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlAutoClose()
1366 ctxt->sax->endElement(ctxt->userData, ctxt->name); in htmlAutoClose()
1367 htmlnamePop(ctxt); in htmlAutoClose()
1370 htmlAutoCloseOnEnd(ctxt); in htmlAutoClose()
1373 while ((newtag == NULL) && (ctxt->name != NULL) && in htmlAutoClose()
1374 ((xmlStrEqual(ctxt->name, BAD_CAST "head")) || in htmlAutoClose()
1375 (xmlStrEqual(ctxt->name, BAD_CAST "body")) || in htmlAutoClose()
1376 (xmlStrEqual(ctxt->name, BAD_CAST "html")))) { in htmlAutoClose()
1377 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlAutoClose()
1378 ctxt->sax->endElement(ctxt->userData, ctxt->name); in htmlAutoClose()
1379 htmlnamePop(ctxt); in htmlAutoClose()
1445 htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { in htmlCheckImplied() argument
1448 if (ctxt->options & HTML_PARSE_NOIMPLIED) in htmlCheckImplied()
1454 if (ctxt->nameNr <= 0) { in htmlCheckImplied()
1455 htmlnamePush(ctxt, BAD_CAST"html"); in htmlCheckImplied()
1456 if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) in htmlCheckImplied()
1457 ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL); in htmlCheckImplied()
1461 if ((ctxt->nameNr <= 1) && in htmlCheckImplied()
1468 if (ctxt->html >= 3) { in htmlCheckImplied()
1476 htmlnamePush(ctxt, BAD_CAST"head"); in htmlCheckImplied()
1477 if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) in htmlCheckImplied()
1478 ctxt->sax->startElement(ctxt->userData, BAD_CAST"head", NULL); in htmlCheckImplied()
1482 if (ctxt->html >= 10) { in htmlCheckImplied()
1486 for (i = 0;i < ctxt->nameNr;i++) { in htmlCheckImplied()
1487 if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"body")) { in htmlCheckImplied()
1490 if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"head")) { in htmlCheckImplied()
1495 htmlnamePush(ctxt, BAD_CAST"body"); in htmlCheckImplied()
1496 if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) in htmlCheckImplied()
1497 ctxt->sax->startElement(ctxt->userData, BAD_CAST"body", NULL); in htmlCheckImplied()
1513 htmlCheckParagraph(htmlParserCtxtPtr ctxt) { in htmlCheckParagraph() argument
1517 if (ctxt == NULL) in htmlCheckParagraph()
1519 tag = ctxt->name; in htmlCheckParagraph()
1521 htmlAutoClose(ctxt, BAD_CAST"p"); in htmlCheckParagraph()
1522 htmlCheckImplied(ctxt, BAD_CAST"p"); in htmlCheckParagraph()
1523 htmlnamePush(ctxt, BAD_CAST"p"); in htmlCheckParagraph()
1524 if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) in htmlCheckParagraph()
1525 ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL); in htmlCheckParagraph()
1532 htmlAutoClose(ctxt, BAD_CAST"p"); in htmlCheckParagraph()
1533 htmlCheckImplied(ctxt, BAD_CAST"p"); in htmlCheckParagraph()
1534 htmlnamePush(ctxt, BAD_CAST"p"); in htmlCheckParagraph()
1535 if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) in htmlCheckParagraph()
1536 ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL); in htmlCheckParagraph()
1875 htmlErrMemory(ctxt, "growing buffer\n"); \
2146 htmlNewInputStream(htmlParserCtxtPtr ctxt) { in htmlNewInputStream() argument
2151 htmlErrMemory(ctxt, "couldn't allocate a new input stream\n"); in htmlNewInputStream()
2202 static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) { in areBlanks() argument
2213 if (ctxt->name == NULL) in areBlanks()
2215 if (xmlStrEqual(ctxt->name, BAD_CAST"html")) in areBlanks()
2217 if (xmlStrEqual(ctxt->name, BAD_CAST"head")) in areBlanks()
2221 if (xmlStrEqual(ctxt->name, BAD_CAST "body") && ctxt->myDoc != NULL) { in areBlanks()
2222 dtd = xmlGetIntSubset(ctxt->myDoc); in areBlanks()
2230 if (ctxt->node == NULL) return(0); in areBlanks()
2231 lastChild = xmlGetLastChild(ctxt->node); in areBlanks()
2235 if ((ctxt->node->type != XML_ELEMENT_NODE) && in areBlanks()
2236 (ctxt->node->content != NULL)) return(0); in areBlanks()
2240 if ( xmlStrEqual(ctxt->name, BAD_CAST allowPCData[i]) ) { in areBlanks()
2337 static const xmlChar * htmlParseNameComplex(xmlParserCtxtPtr ctxt);
2350 htmlParseHTMLName(htmlParserCtxtPtr ctxt) { in htmlParseHTMLName() argument
2368 return(xmlDictLookup(ctxt->dict, loc, i)); in htmlParseHTMLName()
2384 htmlParseHTMLName_nonInvasive(htmlParserCtxtPtr ctxt) { in htmlParseHTMLName_nonInvasive() argument
2399 return(xmlDictLookup(ctxt->dict, loc, i)); in htmlParseHTMLName_nonInvasive()
2413 htmlParseName(htmlParserCtxtPtr ctxt) { in htmlParseName() argument
2423 in = ctxt->input->cur; in htmlParseName()
2435 count = in - ctxt->input->cur; in htmlParseName()
2436 ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); in htmlParseName()
2437 ctxt->input->cur = in; in htmlParseName()
2438 ctxt->nbChars += count; in htmlParseName()
2439 ctxt->input->col += count; in htmlParseName()
2443 return(htmlParseNameComplex(ctxt)); in htmlParseName()
2447 htmlParseNameComplex(xmlParserCtxtPtr ctxt) { in htmlParseNameComplex() argument
2477 return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); in htmlParseNameComplex()
2493 htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { in htmlParseHTMLAttribute() argument
2507 htmlErrMemory(ctxt, "buffer allocation failed\n"); in htmlParseHTMLAttribute()
2523 c = htmlParseCharRef(ctxt); in htmlParseHTMLAttribute()
2544 ent = htmlParseEntityRef(ctxt, &name); in htmlParseHTMLAttribute()
2633 htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) { in htmlParseEntityRef() argument
2638 if ((ctxt == NULL) || (ctxt->input == NULL)) return(NULL); in htmlParseEntityRef()
2642 name = htmlParseName(ctxt); in htmlParseEntityRef()
2644 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, in htmlParseEntityRef()
2659 htmlParseErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, in htmlParseEntityRef()
2683 htmlParseAttValue(htmlParserCtxtPtr ctxt) { in htmlParseAttValue() argument
2688 ret = htmlParseHTMLAttribute(ctxt, '"'); in htmlParseAttValue()
2690 htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, in htmlParseAttValue()
2696 ret = htmlParseHTMLAttribute(ctxt, '\''); in htmlParseAttValue()
2698 htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, in htmlParseAttValue()
2706 ret = htmlParseHTMLAttribute(ctxt, 0); in htmlParseAttValue()
2708 htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, in htmlParseAttValue()
2727 htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { in htmlParseSystemLiteral() argument
2737 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, in htmlParseSystemLiteral()
2749 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, in htmlParseSystemLiteral()
2756 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, in htmlParseSystemLiteral()
2775 htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { in htmlParsePubidLiteral() argument
2786 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, in htmlParsePubidLiteral()
2798 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, in htmlParsePubidLiteral()
2805 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, in htmlParsePubidLiteral()
2834 htmlParseScript(htmlParserCtxtPtr ctxt) { in htmlParseScript() argument
2854 if (ctxt->recovery) { in htmlParseScript()
2855 if (xmlStrncasecmp(ctxt->name, ctxt->input->cur+2, in htmlParseScript()
2856 xmlStrlen(ctxt->name)) == 0) in htmlParseScript()
2860 htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, in htmlParseScript()
2862 ctxt->name, NULL); in htmlParseScript()
2874 if (ctxt->sax->cdataBlock!= NULL) { in htmlParseScript()
2878 ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); in htmlParseScript()
2879 } else if (ctxt->sax->characters != NULL) { in htmlParseScript()
2880 ctxt->sax->characters(ctxt->userData, buf, nbchar); in htmlParseScript()
2889 if ((!(IS_CHAR_CH(cur))) && (!((cur == 0) && (ctxt->progressive)))) { in htmlParseScript()
2890 htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, in htmlParseScript()
2892 if (ctxt->input->cur < ctxt->input->end) { in htmlParseScript()
2897 if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { in htmlParseScript()
2898 if (ctxt->sax->cdataBlock!= NULL) { in htmlParseScript()
2902 ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); in htmlParseScript()
2903 } else if (ctxt->sax->characters != NULL) { in htmlParseScript()
2904 ctxt->sax->characters(ctxt->userData, buf, nbchar); in htmlParseScript()
2921 htmlParseCharData(htmlParserCtxtPtr ctxt) { in htmlParseCharData() argument
2929 while (((cur != '<') || (ctxt->token == '<')) && in htmlParseCharData()
2930 ((cur != '&') || (ctxt->token == '&')) && in htmlParseCharData()
2933 htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, in htmlParseCharData()
2942 if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { in htmlParseCharData()
2943 if (areBlanks(ctxt, buf, nbchar)) { in htmlParseCharData()
2944 if (ctxt->sax->ignorableWhitespace != NULL) in htmlParseCharData()
2945 ctxt->sax->ignorableWhitespace(ctxt->userData, in htmlParseCharData()
2948 htmlCheckParagraph(ctxt); in htmlParseCharData()
2949 if (ctxt->sax->characters != NULL) in htmlParseCharData()
2950 ctxt->sax->characters(ctxt->userData, buf, nbchar); in htmlParseCharData()
2975 if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { in htmlParseCharData()
2976 if (areBlanks(ctxt, buf, nbchar)) { in htmlParseCharData()
2977 if (ctxt->sax->ignorableWhitespace != NULL) in htmlParseCharData()
2978 ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); in htmlParseCharData()
2980 htmlCheckParagraph(ctxt); in htmlParseCharData()
2981 if (ctxt->sax->characters != NULL) in htmlParseCharData()
2982 ctxt->sax->characters(ctxt->userData, buf, nbchar); in htmlParseCharData()
2990 ctxt->instate = XML_PARSER_EOF; in htmlParseCharData()
3012 htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) { in htmlParseExternalID() argument
3020 htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED, in htmlParseExternalID()
3024 URI = htmlParseSystemLiteral(ctxt); in htmlParseExternalID()
3026 htmlParseErr(ctxt, XML_ERR_URI_REQUIRED, in htmlParseExternalID()
3034 htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED, in htmlParseExternalID()
3038 *publicID = htmlParsePubidLiteral(ctxt); in htmlParseExternalID()
3040 htmlParseErr(ctxt, XML_ERR_PUBID_REQUIRED, in htmlParseExternalID()
3046 URI = htmlParseSystemLiteral(ctxt); in htmlParseExternalID()
3061 htmlParsePI(htmlParserCtxtPtr ctxt) { in htmlParsePI() argument
3071 state = ctxt->instate; in htmlParsePI()
3072 ctxt->instate = XML_PARSER_PI; in htmlParsePI()
3083 target = htmlParseName(ctxt); in htmlParsePI()
3091 if ((ctxt->sax) && (!ctxt->disableSAX) && in htmlParsePI()
3092 (ctxt->sax->processingInstruction != NULL)) in htmlParsePI()
3093 ctxt->sax->processingInstruction(ctxt->userData, in htmlParsePI()
3095 ctxt->instate = state; in htmlParsePI()
3100 htmlErrMemory(ctxt, NULL); in htmlParsePI()
3101 ctxt->instate = state; in htmlParsePI()
3106 htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED, in htmlParsePI()
3118 htmlErrMemory(ctxt, NULL); in htmlParsePI()
3120 ctxt->instate = state; in htmlParsePI()
3141 htmlParseErr(ctxt, XML_ERR_PI_NOT_FINISHED, in htmlParsePI()
3149 if ((ctxt->sax) && (!ctxt->disableSAX) && in htmlParsePI()
3150 (ctxt->sax->processingInstruction != NULL)) in htmlParsePI()
3151 ctxt->sax->processingInstruction(ctxt->userData, in htmlParsePI()
3156 htmlParseErr(ctxt, XML_ERR_PI_NOT_STARTED, in htmlParsePI()
3159 ctxt->instate = state; in htmlParsePI()
3172 htmlParseComment(htmlParserCtxtPtr ctxt) { in htmlParseComment() argument
3187 state = ctxt->instate; in htmlParseComment()
3188 ctxt->instate = XML_PARSER_COMMENT; in htmlParseComment()
3193 htmlErrMemory(ctxt, "buffer allocation failed\n"); in htmlParseComment()
3194 ctxt->instate = state; in htmlParseComment()
3213 htmlErrMemory(ctxt, "growing buffer failed\n"); in htmlParseComment()
3214 ctxt->instate = state; in htmlParseComment()
3234 htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, in htmlParseComment()
3239 if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) && in htmlParseComment()
3240 (!ctxt->disableSAX)) in htmlParseComment()
3241 ctxt->sax->comment(ctxt->userData, buf); in htmlParseComment()
3244 ctxt->instate = state; in htmlParseComment()
3259 htmlParseCharRef(htmlParserCtxtPtr ctxt) { in htmlParseCharRef() argument
3262 if ((ctxt == NULL) || (ctxt->input == NULL)) { in htmlParseCharRef()
3263 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseCharRef()
3279 htmlParseErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, in htmlParseCharRef()
3294 htmlParseErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, in htmlParseCharRef()
3304 htmlParseErr(ctxt, XML_ERR_INVALID_CHARREF, in htmlParseCharRef()
3313 htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, in htmlParseCharRef()
3332 htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) { in htmlParseDocTypeDecl() argument
3347 name = htmlParseName(ctxt); in htmlParseDocTypeDecl()
3349 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, in htmlParseDocTypeDecl()
3362 URI = htmlParseExternalID(ctxt, &ExternalID); in htmlParseDocTypeDecl()
3369 htmlParseErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED, in htmlParseDocTypeDecl()
3378 if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) && in htmlParseDocTypeDecl()
3379 (!ctxt->disableSAX)) in htmlParseDocTypeDecl()
3380 ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI); in htmlParseDocTypeDecl()
3411 htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) { in htmlParseAttribute() argument
3416 name = htmlParseHTMLName(ctxt); in htmlParseAttribute()
3418 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, in htmlParseAttribute()
3430 val = htmlParseAttValue(ctxt); in htmlParseAttribute()
3448 htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) { in htmlCheckEncoding() argument
3451 if ((ctxt == NULL) || (attvalue == NULL) || in htmlCheckEncoding()
3452 (ctxt->options & HTML_PARSE_IGNORE_ENC)) in htmlCheckEncoding()
3456 if (ctxt->input->encoding != NULL) in htmlCheckEncoding()
3473 if (ctxt->input->encoding != NULL) in htmlCheckEncoding()
3474 xmlFree((xmlChar *) ctxt->input->encoding); in htmlCheckEncoding()
3475 ctxt->input->encoding = xmlStrdup(encoding); in htmlCheckEncoding()
3486 (ctxt->input->buf != NULL) && in htmlCheckEncoding()
3487 (ctxt->input->buf->encoder == NULL)) { in htmlCheckEncoding()
3488 htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, in htmlCheckEncoding()
3492 xmlSwitchEncoding(ctxt, enc); in htmlCheckEncoding()
3494 ctxt->charset = XML_CHAR_ENCODING_UTF8; in htmlCheckEncoding()
3501 xmlSwitchToEncoding(ctxt, handler); in htmlCheckEncoding()
3502 ctxt->charset = XML_CHAR_ENCODING_UTF8; in htmlCheckEncoding()
3504 htmlParseErr(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in htmlCheckEncoding()
3510 if ((ctxt->input->buf != NULL) && in htmlCheckEncoding()
3511 (ctxt->input->buf->encoder != NULL) && in htmlCheckEncoding()
3512 (ctxt->input->buf->raw != NULL) && in htmlCheckEncoding()
3513 (ctxt->input->buf->buffer != NULL)) { in htmlCheckEncoding()
3520 processed = ctxt->input->cur - ctxt->input->base; in htmlCheckEncoding()
3521 xmlBufferShrink(ctxt->input->buf->buffer, processed); in htmlCheckEncoding()
3522 nbchars = xmlCharEncInFunc(ctxt->input->buf->encoder, in htmlCheckEncoding()
3523 ctxt->input->buf->buffer, in htmlCheckEncoding()
3524 ctxt->input->buf->raw); in htmlCheckEncoding()
3526 htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, in htmlCheckEncoding()
3530 ctxt->input->base = in htmlCheckEncoding()
3531 ctxt->input->cur = ctxt->input->buf->buffer->content; in htmlCheckEncoding()
3532 ctxt->input->end = in htmlCheckEncoding()
3533 &ctxt->input->base[ctxt->input->buf->buffer->use]; in htmlCheckEncoding()
3546 htmlCheckMeta(htmlParserCtxtPtr ctxt, const xmlChar **atts) { in htmlCheckMeta() argument
3552 if ((ctxt == NULL) || (atts == NULL)) in htmlCheckMeta()
3567 htmlCheckEncoding(ctxt, content); in htmlCheckMeta()
3592 htmlParseStartTag(htmlParserCtxtPtr ctxt) { in htmlParseStartTag() argument
3603 if (ctxt->instate == XML_PARSER_EOF) in htmlParseStartTag()
3605 if ((ctxt == NULL) || (ctxt->input == NULL)) { in htmlParseStartTag()
3606 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseStartTag()
3613 atts = ctxt->atts; in htmlParseStartTag()
3614 maxatts = ctxt->maxatts; in htmlParseStartTag()
3617 name = htmlParseHTMLName(ctxt); in htmlParseStartTag()
3619 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, in htmlParseStartTag()
3624 (ctxt->instate != XML_PARSER_EOF)) in htmlParseStartTag()
3634 htmlAutoClose(ctxt, name); in htmlParseStartTag()
3639 htmlCheckImplied(ctxt, name); in htmlParseStartTag()
3645 if ((ctxt->nameNr > 0) && (xmlStrEqual(name, BAD_CAST"html"))) { in htmlParseStartTag()
3646 htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, in htmlParseStartTag()
3650 ctxt->depth++; in htmlParseStartTag()
3652 if ((ctxt->nameNr != 1) && in htmlParseStartTag()
3654 htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, in htmlParseStartTag()
3658 ctxt->depth++; in htmlParseStartTag()
3662 for (indx = 0;indx < ctxt->nameNr;indx++) { in htmlParseStartTag()
3663 if (xmlStrEqual(ctxt->nameTab[indx], BAD_CAST"body")) { in htmlParseStartTag()
3664 htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, in htmlParseStartTag()
3668 ctxt->depth++; in htmlParseStartTag()
3682 long cons = ctxt->nbChars; in htmlParseStartTag()
3685 attname = htmlParseAttribute(ctxt, &attvalue); in htmlParseStartTag()
3693 htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_REDEFINED, in htmlParseStartTag()
3709 htmlErrMemory(ctxt, NULL); in htmlParseStartTag()
3714 ctxt->atts = atts; in htmlParseStartTag()
3715 ctxt->maxatts = maxatts; in htmlParseStartTag()
3723 htmlErrMemory(ctxt, NULL); in htmlParseStartTag()
3729 ctxt->atts = atts; in htmlParseStartTag()
3730 ctxt->maxatts = maxatts; in htmlParseStartTag()
3750 if (cons == ctxt->nbChars) { in htmlParseStartTag()
3751 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseStartTag()
3762 htmlCheckMeta(ctxt, atts); in htmlParseStartTag()
3768 htmlnamePush(ctxt, name); in htmlParseStartTag()
3769 if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) { in htmlParseStartTag()
3771 ctxt->sax->startElement(ctxt->userData, name, atts); in htmlParseStartTag()
3773 ctxt->sax->startElement(ctxt->userData, name, NULL); in htmlParseStartTag()
3803 htmlParseEndTag(htmlParserCtxtPtr ctxt) in htmlParseEndTag() argument
3810 htmlParseErr(ctxt, XML_ERR_LTSLASH_REQUIRED, in htmlParseEndTag()
3816 name = htmlParseHTMLName(ctxt); in htmlParseEndTag()
3824 htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, in htmlParseEndTag()
3826 if (ctxt->recovery) { in htmlParseEndTag()
3842 if ((ctxt->depth > 0) && in htmlParseEndTag()
3846 ctxt->depth--; in htmlParseEndTag()
3854 for (i = (ctxt->nameNr - 1); i >= 0; i--) { in htmlParseEndTag()
3855 if (xmlStrEqual(name, ctxt->nameTab[i])) in htmlParseEndTag()
3859 htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, in htmlParseEndTag()
3869 htmlAutoCloseOnClose(ctxt, name); in htmlParseEndTag()
3876 if (!xmlStrEqual(name, ctxt->name)) { in htmlParseEndTag()
3877 if ((ctxt->name != NULL) && (!xmlStrEqual(ctxt->name, name))) { in htmlParseEndTag()
3878 htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, in htmlParseEndTag()
3880 name, ctxt->name); in htmlParseEndTag()
3887 oldname = ctxt->name; in htmlParseEndTag()
3889 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlParseEndTag()
3890 ctxt->sax->endElement(ctxt->userData, name); in htmlParseEndTag()
3891 htmlnamePop(ctxt); in htmlParseEndTag()
3910 htmlParseReference(htmlParserCtxtPtr ctxt) { in htmlParseReference() argument
3920 c = htmlParseCharRef(ctxt); in htmlParseReference()
3934 htmlCheckParagraph(ctxt); in htmlParseReference()
3935 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) in htmlParseReference()
3936 ctxt->sax->characters(ctxt->userData, out, i); in htmlParseReference()
3938 ent = htmlParseEntityRef(ctxt, &name); in htmlParseReference()
3940 htmlCheckParagraph(ctxt); in htmlParseReference()
3941 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) in htmlParseReference()
3942 ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1); in htmlParseReference()
3946 htmlCheckParagraph(ctxt); in htmlParseReference()
3947 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) { in htmlParseReference()
3948 ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1); in htmlParseReference()
3949 ctxt->sax->characters(ctxt->userData, name, xmlStrlen(name)); in htmlParseReference()
3971 htmlCheckParagraph(ctxt); in htmlParseReference()
3972 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) in htmlParseReference()
3973 ctxt->sax->characters(ctxt->userData, out, i); in htmlParseReference()
3987 htmlParseContent(htmlParserCtxtPtr ctxt) { in htmlParseContent() argument
3992 currentNode = xmlStrdup(ctxt->name); in htmlParseContent()
3993 depth = ctxt->nameNr; in htmlParseContent()
3995 long cons = ctxt->nbChars; in htmlParseContent()
3999 if (ctxt->instate == XML_PARSER_EOF) in htmlParseContent()
4006 if (htmlParseEndTag(ctxt) && in htmlParseContent()
4007 ((currentNode != NULL) || (ctxt->nameNr == 0))) { in htmlParseContent()
4018 name = htmlParseHTMLName_nonInvasive(ctxt); in htmlParseContent()
4020 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, in htmlParseContent()
4032 if (ctxt->name != NULL) { in htmlParseContent()
4033 if (htmlCheckAutoClose(name, ctxt->name) == 1) { in htmlParseContent()
4034 htmlAutoClose(ctxt, name); in htmlParseContent()
4044 if ((ctxt->nameNr > 0) && (depth >= ctxt->nameNr) && in htmlParseContent()
4045 (!xmlStrEqual(currentNode, ctxt->name))) in htmlParseContent()
4056 htmlParseScript(ctxt); in htmlParseContent()
4066 htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, in htmlParseContent()
4069 htmlParseDocTypeDecl(ctxt); in htmlParseContent()
4077 htmlParseComment(ctxt); in htmlParseContent()
4084 htmlParsePI(ctxt); in htmlParseContent()
4091 htmlParseElement(ctxt); in htmlParseContent()
4099 htmlParseReference(ctxt); in htmlParseContent()
4106 htmlAutoCloseOnEnd(ctxt); in htmlParseContent()
4114 htmlParseCharData(ctxt); in htmlParseContent()
4117 if (cons == ctxt->nbChars) { in htmlParseContent()
4118 if (ctxt->node != NULL) { in htmlParseContent()
4119 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseContent()
4144 htmlParseElement(htmlParserCtxtPtr ctxt) { in htmlParseElement() argument
4153 if ((ctxt == NULL) || (ctxt->input == NULL)) { in htmlParseElement()
4154 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseElement()
4159 if (ctxt->instate == XML_PARSER_EOF) in htmlParseElement()
4163 if (ctxt->record_info) { in htmlParseElement()
4164 node_info.begin_pos = ctxt->input->consumed + in htmlParseElement()
4165 (CUR_PTR - ctxt->input->base); in htmlParseElement()
4166 node_info.begin_line = ctxt->input->line; in htmlParseElement()
4169 failed = htmlParseStartTag(ctxt); in htmlParseElement()
4170 name = ctxt->name; in htmlParseElement()
4182 htmlParseErr(ctxt, XML_HTML_UNKNOWN_TAG, in htmlParseElement()
4191 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlParseElement()
4192 ctxt->sax->endElement(ctxt->userData, name); in htmlParseElement()
4193 htmlnamePop(ctxt); in htmlParseElement()
4200 htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, in htmlParseElement()
4206 if (xmlStrEqual(name, ctxt->name)) { in htmlParseElement()
4207 nodePop(ctxt); in htmlParseElement()
4208 htmlnamePop(ctxt); in htmlParseElement()
4214 if (ctxt->record_info) { in htmlParseElement()
4215 node_info.end_pos = ctxt->input->consumed + in htmlParseElement()
4216 (CUR_PTR - ctxt->input->base); in htmlParseElement()
4217 node_info.end_line = ctxt->input->line; in htmlParseElement()
4218 node_info.node = ctxt->node; in htmlParseElement()
4219 xmlParserAddNodeInfo(ctxt, &node_info); in htmlParseElement()
4228 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlParseElement()
4229 ctxt->sax->endElement(ctxt->userData, name); in htmlParseElement()
4230 htmlnamePop(ctxt); in htmlParseElement()
4237 currentNode = xmlStrdup(ctxt->name); in htmlParseElement()
4238 depth = ctxt->nameNr; in htmlParseElement()
4240 oldptr = ctxt->input->cur; in htmlParseElement()
4241 htmlParseContent(ctxt); in htmlParseElement()
4242 if (oldptr==ctxt->input->cur) break; in htmlParseElement()
4243 if (ctxt->nameNr < depth) break; in htmlParseElement()
4249 if ( currentNode != NULL && ctxt->record_info ) { in htmlParseElement()
4250 node_info.end_pos = ctxt->input->consumed + in htmlParseElement()
4251 (CUR_PTR - ctxt->input->base); in htmlParseElement()
4252 node_info.end_line = ctxt->input->line; in htmlParseElement()
4253 node_info.node = ctxt->node; in htmlParseElement()
4254 xmlParserAddNodeInfo(ctxt, &node_info); in htmlParseElement()
4257 htmlAutoCloseOnEnd(ctxt); in htmlParseElement()
4265 htmlParserFinishElementParsing(htmlParserCtxtPtr ctxt) { in htmlParserFinishElementParsing() argument
4269 if ( ctxt->node != NULL && ctxt->record_info ) { in htmlParserFinishElementParsing()
4270 ctxt->nodeInfo->end_pos = ctxt->input->consumed + in htmlParserFinishElementParsing()
4271 (CUR_PTR - ctxt->input->base); in htmlParserFinishElementParsing()
4272 ctxt->nodeInfo->end_line = ctxt->input->line; in htmlParserFinishElementParsing()
4273 ctxt->nodeInfo->node = ctxt->node; in htmlParserFinishElementParsing()
4274 xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo); in htmlParserFinishElementParsing()
4275 htmlNodeInfoPop(ctxt); in htmlParserFinishElementParsing()
4278 htmlAutoCloseOnEnd(ctxt); in htmlParserFinishElementParsing()
4294 htmlParseElementInternal(htmlParserCtxtPtr ctxt) { in htmlParseElementInternal() argument
4300 if ((ctxt == NULL) || (ctxt->input == NULL)) { in htmlParseElementInternal()
4301 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseElementInternal()
4306 if (ctxt->instate == XML_PARSER_EOF) in htmlParseElementInternal()
4310 if (ctxt->record_info) { in htmlParseElementInternal()
4311 node_info.begin_pos = ctxt->input->consumed + in htmlParseElementInternal()
4312 (CUR_PTR - ctxt->input->base); in htmlParseElementInternal()
4313 node_info.begin_line = ctxt->input->line; in htmlParseElementInternal()
4316 failed = htmlParseStartTag(ctxt); in htmlParseElementInternal()
4317 name = ctxt->name; in htmlParseElementInternal()
4329 htmlParseErr(ctxt, XML_HTML_UNKNOWN_TAG, in htmlParseElementInternal()
4338 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlParseElementInternal()
4339 ctxt->sax->endElement(ctxt->userData, name); in htmlParseElementInternal()
4340 htmlnamePop(ctxt); in htmlParseElementInternal()
4347 htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, in htmlParseElementInternal()
4353 if (xmlStrEqual(name, ctxt->name)) { in htmlParseElementInternal()
4354 nodePop(ctxt); in htmlParseElementInternal()
4355 htmlnamePop(ctxt); in htmlParseElementInternal()
4358 if (ctxt->record_info) in htmlParseElementInternal()
4359 htmlNodeInfoPush(ctxt, &node_info); in htmlParseElementInternal()
4360 htmlParserFinishElementParsing(ctxt); in htmlParseElementInternal()
4368 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlParseElementInternal()
4369 ctxt->sax->endElement(ctxt->userData, name); in htmlParseElementInternal()
4370 htmlnamePop(ctxt); in htmlParseElementInternal()
4374 if (ctxt->record_info) in htmlParseElementInternal()
4375 htmlNodeInfoPush(ctxt, &node_info); in htmlParseElementInternal()
4387 htmlParseContentInternal(htmlParserCtxtPtr ctxt) { in htmlParseContentInternal() argument
4392 currentNode = xmlStrdup(ctxt->name); in htmlParseContentInternal()
4393 depth = ctxt->nameNr; in htmlParseContentInternal()
4395 long cons = ctxt->nbChars; in htmlParseContentInternal()
4399 if (ctxt->instate == XML_PARSER_EOF) in htmlParseContentInternal()
4406 if (htmlParseEndTag(ctxt) && in htmlParseContentInternal()
4407 ((currentNode != NULL) || (ctxt->nameNr == 0))) { in htmlParseContentInternal()
4411 currentNode = xmlStrdup(ctxt->name); in htmlParseContentInternal()
4412 depth = ctxt->nameNr; in htmlParseContentInternal()
4420 name = htmlParseHTMLName_nonInvasive(ctxt); in htmlParseContentInternal()
4422 htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, in htmlParseContentInternal()
4429 htmlParserFinishElementParsing(ctxt); in htmlParseContentInternal()
4433 currentNode = xmlStrdup(ctxt->name); in htmlParseContentInternal()
4434 depth = ctxt->nameNr; in htmlParseContentInternal()
4438 if (ctxt->name != NULL) { in htmlParseContentInternal()
4439 if (htmlCheckAutoClose(name, ctxt->name) == 1) { in htmlParseContentInternal()
4440 htmlAutoClose(ctxt, name); in htmlParseContentInternal()
4450 if ((ctxt->nameNr > 0) && (depth >= ctxt->nameNr) && in htmlParseContentInternal()
4451 (!xmlStrEqual(currentNode, ctxt->name))) in htmlParseContentInternal()
4453 htmlParserFinishElementParsing(ctxt); in htmlParseContentInternal()
4456 currentNode = xmlStrdup(ctxt->name); in htmlParseContentInternal()
4457 depth = ctxt->nameNr; in htmlParseContentInternal()
4466 htmlParseScript(ctxt); in htmlParseContentInternal()
4476 htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, in htmlParseContentInternal()
4479 htmlParseDocTypeDecl(ctxt); in htmlParseContentInternal()
4487 htmlParseComment(ctxt); in htmlParseContentInternal()
4494 htmlParsePI(ctxt); in htmlParseContentInternal()
4501 htmlParseElementInternal(ctxt); in htmlParseContentInternal()
4504 currentNode = xmlStrdup(ctxt->name); in htmlParseContentInternal()
4505 depth = ctxt->nameNr; in htmlParseContentInternal()
4513 htmlParseReference(ctxt); in htmlParseContentInternal()
4520 htmlAutoCloseOnEnd(ctxt); in htmlParseContentInternal()
4528 htmlParseCharData(ctxt); in htmlParseContentInternal()
4531 if (cons == ctxt->nbChars) { in htmlParseContentInternal()
4532 if (ctxt->node != NULL) { in htmlParseContentInternal()
4533 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseContentInternal()
4554 __htmlParseContent(void *ctxt) { in __htmlParseContent() argument
4555 if (ctxt != NULL) in __htmlParseContent()
4556 htmlParseContentInternal((htmlParserCtxtPtr) ctxt); in __htmlParseContent()
4571 htmlParseDocument(htmlParserCtxtPtr ctxt) { in htmlParseDocument() argument
4580 if ((ctxt == NULL) || (ctxt->input == NULL)) { in htmlParseDocument()
4581 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseDocument()
4585 ctxt->html = 1; in htmlParseDocument()
4586 ctxt->linenumbers = 1; in htmlParseDocument()
4591 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) in htmlParseDocument()
4592 ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); in htmlParseDocument()
4594 if ((ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) && in htmlParseDocument()
4595 ((ctxt->input->end - ctxt->input->cur) >= 4)) { in htmlParseDocument()
4607 xmlSwitchEncoding(ctxt, enc); in htmlParseDocument()
4616 htmlParseErr(ctxt, XML_ERR_DOCUMENT_EMPTY, in htmlParseDocument()
4620 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX)) in htmlParseDocument()
4621 ctxt->sax->startDocument(ctxt->userData); in htmlParseDocument()
4630 htmlParseComment(ctxt); in htmlParseDocument()
4631 htmlParsePI(ctxt); in htmlParseDocument()
4645 htmlParseDocTypeDecl(ctxt); in htmlParseDocument()
4655 htmlParseComment(ctxt); in htmlParseDocument()
4656 htmlParsePI(ctxt); in htmlParseDocument()
4663 htmlParseContentInternal(ctxt); in htmlParseDocument()
4669 htmlAutoCloseOnEnd(ctxt); in htmlParseDocument()
4675 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in htmlParseDocument()
4676 ctxt->sax->endDocument(ctxt->userData); in htmlParseDocument()
4678 if ((!(ctxt->options & HTML_PARSE_NODEFDTD)) && (ctxt->myDoc != NULL)) { in htmlParseDocument()
4679 dtd = xmlGetIntSubset(ctxt->myDoc); in htmlParseDocument()
4681 ctxt->myDoc->intSubset = in htmlParseDocument()
4682 xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "html", in htmlParseDocument()
4686 if (! ctxt->wellFormed) return(-1); in htmlParseDocument()
4707 htmlInitParserCtxt(htmlParserCtxtPtr ctxt) in htmlInitParserCtxt() argument
4711 if (ctxt == NULL) return(-1); in htmlInitParserCtxt()
4712 memset(ctxt, 0, sizeof(htmlParserCtxt)); in htmlInitParserCtxt()
4714 ctxt->dict = xmlDictCreate(); in htmlInitParserCtxt()
4715 if (ctxt->dict == NULL) { in htmlInitParserCtxt()
4728 ctxt->inputTab = (htmlParserInputPtr *) in htmlInitParserCtxt()
4730 if (ctxt->inputTab == NULL) { in htmlInitParserCtxt()
4732 ctxt->inputNr = 0; in htmlInitParserCtxt()
4733 ctxt->inputMax = 0; in htmlInitParserCtxt()
4734 ctxt->input = NULL; in htmlInitParserCtxt()
4737 ctxt->inputNr = 0; in htmlInitParserCtxt()
4738 ctxt->inputMax = 5; in htmlInitParserCtxt()
4739 ctxt->input = NULL; in htmlInitParserCtxt()
4740 ctxt->version = NULL; in htmlInitParserCtxt()
4741 ctxt->encoding = NULL; in htmlInitParserCtxt()
4742 ctxt->standalone = -1; in htmlInitParserCtxt()
4743 ctxt->instate = XML_PARSER_START; in htmlInitParserCtxt()
4746 ctxt->nodeTab = (htmlNodePtr *) xmlMalloc(10 * sizeof(htmlNodePtr)); in htmlInitParserCtxt()
4747 if (ctxt->nodeTab == NULL) { in htmlInitParserCtxt()
4749 ctxt->nodeNr = 0; in htmlInitParserCtxt()
4750 ctxt->nodeMax = 0; in htmlInitParserCtxt()
4751 ctxt->node = NULL; in htmlInitParserCtxt()
4752 ctxt->inputNr = 0; in htmlInitParserCtxt()
4753 ctxt->inputMax = 0; in htmlInitParserCtxt()
4754 ctxt->input = NULL; in htmlInitParserCtxt()
4757 ctxt->nodeNr = 0; in htmlInitParserCtxt()
4758 ctxt->nodeMax = 10; in htmlInitParserCtxt()
4759 ctxt->node = NULL; in htmlInitParserCtxt()
4762 ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *)); in htmlInitParserCtxt()
4763 if (ctxt->nameTab == NULL) { in htmlInitParserCtxt()
4765 ctxt->nameNr = 0; in htmlInitParserCtxt()
4766 ctxt->nameMax = 0; in htmlInitParserCtxt()
4767 ctxt->name = NULL; in htmlInitParserCtxt()
4768 ctxt->nodeNr = 0; in htmlInitParserCtxt()
4769 ctxt->nodeMax = 0; in htmlInitParserCtxt()
4770 ctxt->node = NULL; in htmlInitParserCtxt()
4771 ctxt->inputNr = 0; in htmlInitParserCtxt()
4772 ctxt->inputMax = 0; in htmlInitParserCtxt()
4773 ctxt->input = NULL; in htmlInitParserCtxt()
4776 ctxt->nameNr = 0; in htmlInitParserCtxt()
4777 ctxt->nameMax = 10; in htmlInitParserCtxt()
4778 ctxt->name = NULL; in htmlInitParserCtxt()
4780 ctxt->nodeInfoTab = NULL; in htmlInitParserCtxt()
4781 ctxt->nodeInfoNr = 0; in htmlInitParserCtxt()
4782 ctxt->nodeInfoMax = 0; in htmlInitParserCtxt()
4784 if (sax == NULL) ctxt->sax = (xmlSAXHandlerPtr) &htmlDefaultSAXHandler; in htmlInitParserCtxt()
4786 ctxt->sax = sax; in htmlInitParserCtxt()
4789 ctxt->userData = ctxt; in htmlInitParserCtxt()
4790 ctxt->myDoc = NULL; in htmlInitParserCtxt()
4791 ctxt->wellFormed = 1; in htmlInitParserCtxt()
4792 ctxt->replaceEntities = 0; in htmlInitParserCtxt()
4793 ctxt->linenumbers = xmlLineNumbersDefaultValue; in htmlInitParserCtxt()
4794 ctxt->html = 1; in htmlInitParserCtxt()
4795 ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0; in htmlInitParserCtxt()
4796 ctxt->vctxt.userData = ctxt; in htmlInitParserCtxt()
4797 ctxt->vctxt.error = xmlParserValidityError; in htmlInitParserCtxt()
4798 ctxt->vctxt.warning = xmlParserValidityWarning; in htmlInitParserCtxt()
4799 ctxt->record_info = 0; in htmlInitParserCtxt()
4800 ctxt->validate = 0; in htmlInitParserCtxt()
4801 ctxt->nbChars = 0; in htmlInitParserCtxt()
4802 ctxt->checkIndex = 0; in htmlInitParserCtxt()
4803 ctxt->catalogs = NULL; in htmlInitParserCtxt()
4804 xmlInitNodeInfoSeq(&ctxt->node_seq); in htmlInitParserCtxt()
4817 htmlFreeParserCtxt(htmlParserCtxtPtr ctxt) in htmlFreeParserCtxt() argument
4819 xmlFreeParserCtxt(ctxt); in htmlFreeParserCtxt()
4833 xmlParserCtxtPtr ctxt; in htmlNewParserCtxt() local
4835 ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt)); in htmlNewParserCtxt()
4836 if (ctxt == NULL) { in htmlNewParserCtxt()
4840 memset(ctxt, 0, sizeof(xmlParserCtxt)); in htmlNewParserCtxt()
4841 if (htmlInitParserCtxt(ctxt) < 0) { in htmlNewParserCtxt()
4842 htmlFreeParserCtxt(ctxt); in htmlNewParserCtxt()
4845 return(ctxt); in htmlNewParserCtxt()
4859 xmlParserCtxtPtr ctxt; in htmlCreateMemoryParserCtxt() local
4868 ctxt = htmlNewParserCtxt(); in htmlCreateMemoryParserCtxt()
4869 if (ctxt == NULL) in htmlCreateMemoryParserCtxt()
4875 input = xmlNewInputStream(ctxt); in htmlCreateMemoryParserCtxt()
4877 xmlFreeParserCtxt(ctxt); in htmlCreateMemoryParserCtxt()
4887 inputPush(ctxt, input); in htmlCreateMemoryParserCtxt()
4888 return(ctxt); in htmlCreateMemoryParserCtxt()
4905 htmlParserCtxtPtr ctxt; in htmlCreateDocParserCtxt() local
4910 ctxt = htmlCreateMemoryParserCtxt((char *)cur, len); in htmlCreateDocParserCtxt()
4911 if (ctxt == NULL) in htmlCreateDocParserCtxt()
4918 if (ctxt->input->encoding != NULL) in htmlCreateDocParserCtxt()
4919 xmlFree((xmlChar *) ctxt->input->encoding); in htmlCreateDocParserCtxt()
4920 ctxt->input->encoding = xmlStrdup((const xmlChar *) encoding); in htmlCreateDocParserCtxt()
4927 xmlSwitchEncoding(ctxt, enc); in htmlCreateDocParserCtxt()
4928 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { in htmlCreateDocParserCtxt()
4929 htmlParseErr(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in htmlCreateDocParserCtxt()
4939 xmlSwitchToEncoding(ctxt, handler); in htmlCreateDocParserCtxt()
4941 htmlParseErr(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in htmlCreateDocParserCtxt()
4947 return(ctxt); in htmlCreateDocParserCtxt()
4976 htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, in htmlParseLookupSequence() argument
4987 in = ctxt->input; in htmlParseLookupSequence()
4995 if (ctxt->checkIndex > base) in htmlParseLookupSequence()
4996 base = ctxt->checkIndex; in htmlParseLookupSequence()
5054 ctxt->checkIndex = 0; in htmlParseLookupSequence()
5073 ctxt->checkIndex = base; in htmlParseLookupSequence()
5105 htmlParseLookupChars(htmlParserCtxtPtr ctxt, const xmlChar * stop, in htmlParseLookupChars() argument
5114 in = ctxt->input; in htmlParseLookupChars()
5122 if (ctxt->checkIndex > base) in htmlParseLookupChars()
5123 base = ctxt->checkIndex; in htmlParseLookupChars()
5154 ctxt->checkIndex = 0; in htmlParseLookupChars()
5159 ctxt->checkIndex = base; in htmlParseLookupChars()
5173 htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { in htmlParseTryOrFinish() argument
5180 switch (ctxt->instate) { in htmlParseTryOrFinish()
5234 in = ctxt->input; in htmlParseTryOrFinish()
5241 htmlAutoCloseOnEnd(ctxt); in htmlParseTryOrFinish()
5242 if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { in htmlParseTryOrFinish()
5246 ctxt->instate = XML_PARSER_EOF; in htmlParseTryOrFinish()
5247 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in htmlParseTryOrFinish()
5248 ctxt->sax->endDocument(ctxt->userData); in htmlParseTryOrFinish()
5259 switch (ctxt->instate) { in htmlParseTryOrFinish()
5277 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) in htmlParseTryOrFinish()
5278 ctxt->sax->setDocumentLocator(ctxt->userData, in htmlParseTryOrFinish()
5280 if ((ctxt->sax) && (ctxt->sax->startDocument) && in htmlParseTryOrFinish()
5281 (!ctxt->disableSAX)) in htmlParseTryOrFinish()
5282 ctxt->sax->startDocument(ctxt->userData); in htmlParseTryOrFinish()
5292 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5298 htmlParseDocTypeDecl(ctxt); in htmlParseTryOrFinish()
5299 ctxt->instate = XML_PARSER_PROLOG; in htmlParseTryOrFinish()
5305 ctxt->instate = XML_PARSER_MISC; in htmlParseTryOrFinish()
5325 (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) in htmlParseTryOrFinish()
5331 htmlParseComment(ctxt); in htmlParseTryOrFinish()
5332 ctxt->instate = XML_PARSER_MISC; in htmlParseTryOrFinish()
5335 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5341 htmlParsePI(ctxt); in htmlParseTryOrFinish()
5342 ctxt->instate = XML_PARSER_MISC; in htmlParseTryOrFinish()
5349 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5355 htmlParseDocTypeDecl(ctxt); in htmlParseTryOrFinish()
5356 ctxt->instate = XML_PARSER_PROLOG; in htmlParseTryOrFinish()
5365 ctxt->instate = XML_PARSER_START_TAG; in htmlParseTryOrFinish()
5385 (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) in htmlParseTryOrFinish()
5391 htmlParseComment(ctxt); in htmlParseTryOrFinish()
5392 ctxt->instate = XML_PARSER_PROLOG; in htmlParseTryOrFinish()
5395 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5401 htmlParsePI(ctxt); in htmlParseTryOrFinish()
5402 ctxt->instate = XML_PARSER_PROLOG; in htmlParseTryOrFinish()
5407 ctxt->instate = XML_PARSER_START_TAG; in htmlParseTryOrFinish()
5423 htmlParseCharData(ctxt); in htmlParseTryOrFinish()
5432 (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) in htmlParseTryOrFinish()
5438 htmlParseComment(ctxt); in htmlParseTryOrFinish()
5439 ctxt->instate = XML_PARSER_EPILOG; in htmlParseTryOrFinish()
5442 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5448 htmlParsePI(ctxt); in htmlParseTryOrFinish()
5449 ctxt->instate = XML_PARSER_EPILOG; in htmlParseTryOrFinish()
5454 ctxt->errNo = XML_ERR_DOCUMENT_END; in htmlParseTryOrFinish()
5455 ctxt->wellFormed = 0; in htmlParseTryOrFinish()
5456 ctxt->instate = XML_PARSER_EOF; in htmlParseTryOrFinish()
5461 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in htmlParseTryOrFinish()
5462 ctxt->sax->endDocument(ctxt->userData); in htmlParseTryOrFinish()
5475 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5483 ctxt->instate = XML_PARSER_END_TAG; in htmlParseTryOrFinish()
5484 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5492 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5495 failed = htmlParseStartTag(ctxt); in htmlParseTryOrFinish()
5496 name = ctxt->name; in htmlParseTryOrFinish()
5509 htmlParseErr(ctxt, XML_HTML_UNKNOWN_TAG, in htmlParseTryOrFinish()
5518 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlParseTryOrFinish()
5519 ctxt->sax->endElement(ctxt->userData, name); in htmlParseTryOrFinish()
5520 htmlnamePop(ctxt); in htmlParseTryOrFinish()
5521 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5532 htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, in htmlParseTryOrFinish()
5539 if (xmlStrEqual(name, ctxt->name)) { in htmlParseTryOrFinish()
5540 nodePop(ctxt); in htmlParseTryOrFinish()
5541 htmlnamePop(ctxt); in htmlParseTryOrFinish()
5544 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5556 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) in htmlParseTryOrFinish()
5557 ctxt->sax->endElement(ctxt->userData, name); in htmlParseTryOrFinish()
5558 htmlnamePop(ctxt); in htmlParseTryOrFinish()
5560 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5572 if (ctxt->token != 0) { in htmlParseTryOrFinish()
5575 chr[0] = (xmlChar) ctxt->token; in htmlParseTryOrFinish()
5576 htmlCheckParagraph(ctxt); in htmlParseTryOrFinish()
5577 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) in htmlParseTryOrFinish()
5578 ctxt->sax->characters(ctxt->userData, chr, 1); in htmlParseTryOrFinish()
5579 ctxt->token = 0; in htmlParseTryOrFinish()
5580 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5585 if (ctxt->sax != NULL) { in htmlParseTryOrFinish()
5587 if (ctxt->sax->ignorableWhitespace != NULL) in htmlParseTryOrFinish()
5588 ctxt->sax->ignorableWhitespace( in htmlParseTryOrFinish()
5589 ctxt->userData, &cur, 1); in htmlParseTryOrFinish()
5591 htmlCheckParagraph(ctxt); in htmlParseTryOrFinish()
5592 if (ctxt->sax->characters != NULL) in htmlParseTryOrFinish()
5593 ctxt->sax->characters( in htmlParseTryOrFinish()
5594 ctxt->userData, &cur, 1); in htmlParseTryOrFinish()
5597 ctxt->token = 0; in htmlParseTryOrFinish()
5598 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5607 cons = ctxt->nbChars; in htmlParseTryOrFinish()
5608 if ((xmlStrEqual(ctxt->name, BAD_CAST"script")) || in htmlParseTryOrFinish()
5609 (xmlStrEqual(ctxt->name, BAD_CAST"style"))) { in htmlParseTryOrFinish()
5617 idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0, 0); in htmlParseTryOrFinish()
5624 htmlParseScript(ctxt); in htmlParseTryOrFinish()
5626 ctxt->instate = XML_PARSER_END_TAG; in htmlParseTryOrFinish()
5627 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5644 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5646 htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, in htmlParseTryOrFinish()
5649 htmlParseDocTypeDecl(ctxt); in htmlParseTryOrFinish()
5654 ctxt, '-', '-', '>', 1, 1) < 0)) in htmlParseTryOrFinish()
5660 htmlParseComment(ctxt); in htmlParseTryOrFinish()
5661 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5664 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5670 htmlParsePI(ctxt); in htmlParseTryOrFinish()
5671 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5675 ctxt->instate = XML_PARSER_END_TAG; in htmlParseTryOrFinish()
5676 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5683 ctxt->instate = XML_PARSER_START_TAG; in htmlParseTryOrFinish()
5684 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5692 (htmlParseLookupChars(ctxt, in htmlParseTryOrFinish()
5700 htmlParseReference(ctxt); in htmlParseTryOrFinish()
5709 (htmlParseLookupChars(ctxt, BAD_CAST "<&", 2) < 0)) in htmlParseTryOrFinish()
5711 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5716 htmlParseCharData(ctxt); in htmlParseTryOrFinish()
5719 if (cons == ctxt->nbChars) { in htmlParseTryOrFinish()
5720 if (ctxt->node != NULL) { in htmlParseTryOrFinish()
5721 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5735 (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) in htmlParseTryOrFinish()
5737 htmlParseEndTag(ctxt); in htmlParseTryOrFinish()
5738 if (ctxt->nameNr == 0) { in htmlParseTryOrFinish()
5739 ctxt->instate = XML_PARSER_EPILOG; in htmlParseTryOrFinish()
5741 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5743 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5750 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5753 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5754 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5761 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5764 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5765 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5772 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5775 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5776 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5783 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5786 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5787 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5794 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5797 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5798 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5805 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5808 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5809 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5816 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5819 ctxt->instate = XML_PARSER_START_TAG; in htmlParseTryOrFinish()
5820 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5827 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5830 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5831 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5838 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5841 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5842 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5849 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseTryOrFinish()
5852 ctxt->instate = XML_PARSER_CONTENT; in htmlParseTryOrFinish()
5853 ctxt->checkIndex = 0; in htmlParseTryOrFinish()
5864 htmlAutoCloseOnEnd(ctxt); in htmlParseTryOrFinish()
5865 if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { in htmlParseTryOrFinish()
5869 ctxt->instate = XML_PARSER_EOF; in htmlParseTryOrFinish()
5870 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in htmlParseTryOrFinish()
5871 ctxt->sax->endDocument(ctxt->userData); in htmlParseTryOrFinish()
5874 if ((ctxt->myDoc != NULL) && in htmlParseTryOrFinish()
5875 ((terminate) || (ctxt->instate == XML_PARSER_EOF) || in htmlParseTryOrFinish()
5876 (ctxt->instate == XML_PARSER_EPILOG))) { in htmlParseTryOrFinish()
5878 dtd = xmlGetIntSubset(ctxt->myDoc); in htmlParseTryOrFinish()
5880 ctxt->myDoc->intSubset = in htmlParseTryOrFinish()
5881 xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "html", in htmlParseTryOrFinish()
5903 htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, in htmlParseChunk() argument
5905 if ((ctxt == NULL) || (ctxt->input == NULL)) { in htmlParseChunk()
5906 htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, in htmlParseChunk()
5910 if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && in htmlParseChunk()
5911 (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { in htmlParseChunk()
5912 int base = ctxt->input->base - ctxt->input->buf->buffer->content; in htmlParseChunk()
5913 int cur = ctxt->input->cur - ctxt->input->base; in htmlParseChunk()
5916 res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk); in htmlParseChunk()
5918 ctxt->errNo = XML_PARSER_EOF; in htmlParseChunk()
5919 ctxt->disableSAX = 1; in htmlParseChunk()
5922 ctxt->input->base = ctxt->input->buf->buffer->content + base; in htmlParseChunk()
5923 ctxt->input->cur = ctxt->input->base + cur; in htmlParseChunk()
5924 ctxt->input->end = in htmlParseChunk()
5925 &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; in htmlParseChunk()
5931 if ((terminate) || (ctxt->input->buf->buffer->use > 80)) in htmlParseChunk()
5932 htmlParseTryOrFinish(ctxt, terminate); in htmlParseChunk()
5934 } else if (ctxt->instate != XML_PARSER_EOF) { in htmlParseChunk()
5935 if ((ctxt->input != NULL) && ctxt->input->buf != NULL) { in htmlParseChunk()
5936 xmlParserInputBufferPtr in = ctxt->input->buf; in htmlParseChunk()
5943 htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, in htmlParseChunk()
5950 htmlParseTryOrFinish(ctxt, terminate); in htmlParseChunk()
5952 if ((ctxt->instate != XML_PARSER_EOF) && in htmlParseChunk()
5953 (ctxt->instate != XML_PARSER_EPILOG) && in htmlParseChunk()
5954 (ctxt->instate != XML_PARSER_MISC)) { in htmlParseChunk()
5955 ctxt->errNo = XML_ERR_DOCUMENT_END; in htmlParseChunk()
5956 ctxt->wellFormed = 0; in htmlParseChunk()
5958 if (ctxt->instate != XML_PARSER_EOF) { in htmlParseChunk()
5959 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in htmlParseChunk()
5960 ctxt->sax->endDocument(ctxt->userData); in htmlParseChunk()
5962 ctxt->instate = XML_PARSER_EOF; in htmlParseChunk()
5964 return((xmlParserErrors) ctxt->errNo); in htmlParseChunk()
5992 htmlParserCtxtPtr ctxt; in htmlCreatePushParserCtxt() local
6001 ctxt = htmlNewParserCtxt(); in htmlCreatePushParserCtxt()
6002 if (ctxt == NULL) { in htmlCreatePushParserCtxt()
6007 ctxt->charset=XML_CHAR_ENCODING_UTF8; in htmlCreatePushParserCtxt()
6009 if (ctxt->sax != (xmlSAXHandlerPtr) &htmlDefaultSAXHandler) in htmlCreatePushParserCtxt()
6010 xmlFree(ctxt->sax); in htmlCreatePushParserCtxt()
6011 ctxt->sax = (htmlSAXHandlerPtr) xmlMalloc(sizeof(htmlSAXHandler)); in htmlCreatePushParserCtxt()
6012 if (ctxt->sax == NULL) { in htmlCreatePushParserCtxt()
6014 xmlFree(ctxt); in htmlCreatePushParserCtxt()
6017 memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler)); in htmlCreatePushParserCtxt()
6019 ctxt->userData = user_data; in htmlCreatePushParserCtxt()
6022 ctxt->directory = NULL; in htmlCreatePushParserCtxt()
6024 ctxt->directory = xmlParserGetDirectory(filename); in htmlCreatePushParserCtxt()
6027 inputStream = htmlNewInputStream(ctxt); in htmlCreatePushParserCtxt()
6029 xmlFreeParserCtxt(ctxt); in htmlCreatePushParserCtxt()
6045 inputPush(ctxt, inputStream); in htmlCreatePushParserCtxt()
6047 if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && in htmlCreatePushParserCtxt()
6048 (ctxt->input->buf != NULL)) { in htmlCreatePushParserCtxt()
6049 int base = ctxt->input->base - ctxt->input->buf->buffer->content; in htmlCreatePushParserCtxt()
6050 int cur = ctxt->input->cur - ctxt->input->base; in htmlCreatePushParserCtxt()
6052 xmlParserInputBufferPush(ctxt->input->buf, size, chunk); in htmlCreatePushParserCtxt()
6054 ctxt->input->base = ctxt->input->buf->buffer->content + base; in htmlCreatePushParserCtxt()
6055 ctxt->input->cur = ctxt->input->base + cur; in htmlCreatePushParserCtxt()
6056 ctxt->input->end = in htmlCreatePushParserCtxt()
6057 &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; in htmlCreatePushParserCtxt()
6062 ctxt->progressive = 1; in htmlCreatePushParserCtxt()
6064 return(ctxt); in htmlCreatePushParserCtxt()
6086 htmlParserCtxtPtr ctxt; in htmlSAXParseDoc() local
6093 ctxt = htmlCreateDocParserCtxt(cur, encoding); in htmlSAXParseDoc()
6094 if (ctxt == NULL) return(NULL); in htmlSAXParseDoc()
6096 if (ctxt->sax != NULL) xmlFree (ctxt->sax); in htmlSAXParseDoc()
6097 ctxt->sax = sax; in htmlSAXParseDoc()
6098 ctxt->userData = userData; in htmlSAXParseDoc()
6101 htmlParseDocument(ctxt); in htmlSAXParseDoc()
6102 ret = ctxt->myDoc; in htmlSAXParseDoc()
6104 ctxt->sax = NULL; in htmlSAXParseDoc()
6105 ctxt->userData = NULL; in htmlSAXParseDoc()
6107 htmlFreeParserCtxt(ctxt); in htmlSAXParseDoc()
6142 htmlParserCtxtPtr ctxt; in htmlCreateFileParserCtxt() local
6151 ctxt = htmlNewParserCtxt(); in htmlCreateFileParserCtxt()
6152 if (ctxt == NULL) { in htmlCreateFileParserCtxt()
6162 xmlFreeParserCtxt(ctxt); in htmlCreateFileParserCtxt()
6166 inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt); in htmlCreateFileParserCtxt()
6169 xmlFreeParserCtxt(ctxt); in htmlCreateFileParserCtxt()
6173 inputPush(ctxt, inputStream); in htmlCreateFileParserCtxt()
6181 htmlCheckEncoding (ctxt, content); in htmlCreateFileParserCtxt()
6186 return(ctxt); in htmlCreateFileParserCtxt()
6209 htmlParserCtxtPtr ctxt; in htmlSAXParseFile() local
6214 ctxt = htmlCreateFileParserCtxt(filename, encoding); in htmlSAXParseFile()
6215 if (ctxt == NULL) return(NULL); in htmlSAXParseFile()
6217 oldsax = ctxt->sax; in htmlSAXParseFile()
6218 ctxt->sax = sax; in htmlSAXParseFile()
6219 ctxt->userData = userData; in htmlSAXParseFile()
6222 htmlParseDocument(ctxt); in htmlSAXParseFile()
6224 ret = ctxt->myDoc; in htmlSAXParseFile()
6226 ctxt->sax = oldsax; in htmlSAXParseFile()
6227 ctxt->userData = NULL; in htmlSAXParseFile()
6229 htmlFreeParserCtxt(ctxt); in htmlSAXParseFile()
6403 htmlCtxtReset(htmlParserCtxtPtr ctxt) in htmlCtxtReset() argument
6408 if (ctxt == NULL) in htmlCtxtReset()
6412 dict = ctxt->dict; in htmlCtxtReset()
6414 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ in htmlCtxtReset()
6417 ctxt->inputNr = 0; in htmlCtxtReset()
6418 ctxt->input = NULL; in htmlCtxtReset()
6420 ctxt->spaceNr = 0; in htmlCtxtReset()
6421 if (ctxt->spaceTab != NULL) { in htmlCtxtReset()
6422 ctxt->spaceTab[0] = -1; in htmlCtxtReset()
6423 ctxt->space = &ctxt->spaceTab[0]; in htmlCtxtReset()
6425 ctxt->space = NULL; in htmlCtxtReset()
6429 ctxt->nodeNr = 0; in htmlCtxtReset()
6430 ctxt->node = NULL; in htmlCtxtReset()
6432 ctxt->nameNr = 0; in htmlCtxtReset()
6433 ctxt->name = NULL; in htmlCtxtReset()
6435 DICT_FREE(ctxt->version); in htmlCtxtReset()
6436 ctxt->version = NULL; in htmlCtxtReset()
6437 DICT_FREE(ctxt->encoding); in htmlCtxtReset()
6438 ctxt->encoding = NULL; in htmlCtxtReset()
6439 DICT_FREE(ctxt->directory); in htmlCtxtReset()
6440 ctxt->directory = NULL; in htmlCtxtReset()
6441 DICT_FREE(ctxt->extSubURI); in htmlCtxtReset()
6442 ctxt->extSubURI = NULL; in htmlCtxtReset()
6443 DICT_FREE(ctxt->extSubSystem); in htmlCtxtReset()
6444 ctxt->extSubSystem = NULL; in htmlCtxtReset()
6445 if (ctxt->myDoc != NULL) in htmlCtxtReset()
6446 xmlFreeDoc(ctxt->myDoc); in htmlCtxtReset()
6447 ctxt->myDoc = NULL; in htmlCtxtReset()
6449 ctxt->standalone = -1; in htmlCtxtReset()
6450 ctxt->hasExternalSubset = 0; in htmlCtxtReset()
6451 ctxt->hasPErefs = 0; in htmlCtxtReset()
6452 ctxt->html = 1; in htmlCtxtReset()
6453 ctxt->external = 0; in htmlCtxtReset()
6454 ctxt->instate = XML_PARSER_START; in htmlCtxtReset()
6455 ctxt->token = 0; in htmlCtxtReset()
6457 ctxt->wellFormed = 1; in htmlCtxtReset()
6458 ctxt->nsWellFormed = 1; in htmlCtxtReset()
6459 ctxt->disableSAX = 0; in htmlCtxtReset()
6460 ctxt->valid = 1; in htmlCtxtReset()
6461 ctxt->vctxt.userData = ctxt; in htmlCtxtReset()
6462 ctxt->vctxt.error = xmlParserValidityError; in htmlCtxtReset()
6463 ctxt->vctxt.warning = xmlParserValidityWarning; in htmlCtxtReset()
6464 ctxt->record_info = 0; in htmlCtxtReset()
6465 ctxt->nbChars = 0; in htmlCtxtReset()
6466 ctxt->checkIndex = 0; in htmlCtxtReset()
6467 ctxt->inSubset = 0; in htmlCtxtReset()
6468 ctxt->errNo = XML_ERR_OK; in htmlCtxtReset()
6469 ctxt->depth = 0; in htmlCtxtReset()
6470 ctxt->charset = XML_CHAR_ENCODING_NONE; in htmlCtxtReset()
6471 ctxt->catalogs = NULL; in htmlCtxtReset()
6472 xmlInitNodeInfoSeq(&ctxt->node_seq); in htmlCtxtReset()
6474 if (ctxt->attsDefault != NULL) { in htmlCtxtReset()
6475 xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); in htmlCtxtReset()
6476 ctxt->attsDefault = NULL; in htmlCtxtReset()
6478 if (ctxt->attsSpecial != NULL) { in htmlCtxtReset()
6479 xmlHashFree(ctxt->attsSpecial, NULL); in htmlCtxtReset()
6480 ctxt->attsSpecial = NULL; in htmlCtxtReset()
6495 htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) in htmlCtxtUseOptions() argument
6497 if (ctxt == NULL) in htmlCtxtUseOptions()
6501 ctxt->sax->warning = NULL; in htmlCtxtUseOptions()
6502 ctxt->vctxt.warning = NULL; in htmlCtxtUseOptions()
6504 ctxt->options |= XML_PARSE_NOWARNING; in htmlCtxtUseOptions()
6507 ctxt->sax->error = NULL; in htmlCtxtUseOptions()
6508 ctxt->vctxt.error = NULL; in htmlCtxtUseOptions()
6509 ctxt->sax->fatalError = NULL; in htmlCtxtUseOptions()
6511 ctxt->options |= XML_PARSE_NOERROR; in htmlCtxtUseOptions()
6514 ctxt->pedantic = 1; in htmlCtxtUseOptions()
6516 ctxt->options |= XML_PARSE_PEDANTIC; in htmlCtxtUseOptions()
6518 ctxt->pedantic = 0; in htmlCtxtUseOptions()
6520 ctxt->keepBlanks = 0; in htmlCtxtUseOptions()
6521 ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace; in htmlCtxtUseOptions()
6523 ctxt->options |= XML_PARSE_NOBLANKS; in htmlCtxtUseOptions()
6525 ctxt->keepBlanks = 1; in htmlCtxtUseOptions()
6527 ctxt->recovery = 1; in htmlCtxtUseOptions()
6530 ctxt->recovery = 0; in htmlCtxtUseOptions()
6532 ctxt->options |= HTML_PARSE_COMPACT; in htmlCtxtUseOptions()
6536 ctxt->options |= XML_PARSE_HUGE; in htmlCtxtUseOptions()
6540 ctxt->options |= HTML_PARSE_NODEFDTD; in htmlCtxtUseOptions()
6544 ctxt->options |= HTML_PARSE_IGNORE_ENC; in htmlCtxtUseOptions()
6547 ctxt->dictNames = 0; in htmlCtxtUseOptions()
6564 htmlDoRead(htmlParserCtxtPtr ctxt, const char *URL, const char *encoding, in htmlDoRead() argument
6569 htmlCtxtUseOptions(ctxt, options); in htmlDoRead()
6570 ctxt->html = 1; in htmlDoRead()
6576 xmlSwitchToEncoding(ctxt, hdlr); in htmlDoRead()
6577 if (ctxt->input->encoding != NULL) in htmlDoRead()
6578 xmlFree((xmlChar *) ctxt->input->encoding); in htmlDoRead()
6579 ctxt->input->encoding = xmlStrdup((xmlChar *)encoding); in htmlDoRead()
6582 if ((URL != NULL) && (ctxt->input != NULL) && in htmlDoRead()
6583 (ctxt->input->filename == NULL)) in htmlDoRead()
6584 ctxt->input->filename = (char *) xmlStrdup((const xmlChar *) URL); in htmlDoRead()
6585 htmlParseDocument(ctxt); in htmlDoRead()
6586 ret = ctxt->myDoc; in htmlDoRead()
6587 ctxt->myDoc = NULL; in htmlDoRead()
6589 if ((ctxt->dictNames) && in htmlDoRead()
6591 (ret->dict == ctxt->dict)) in htmlDoRead()
6592 ctxt->dict = NULL; in htmlDoRead()
6593 xmlFreeParserCtxt(ctxt); in htmlDoRead()
6612 htmlParserCtxtPtr ctxt; in htmlReadDoc() local
6618 ctxt = htmlCreateDocParserCtxt(cur, NULL); in htmlReadDoc()
6619 if (ctxt == NULL) in htmlReadDoc()
6621 return (htmlDoRead(ctxt, URL, encoding, options, 0)); in htmlReadDoc()
6637 htmlParserCtxtPtr ctxt; in htmlReadFile() local
6640 ctxt = htmlCreateFileParserCtxt(filename, encoding); in htmlReadFile()
6641 if (ctxt == NULL) in htmlReadFile()
6643 return (htmlDoRead(ctxt, NULL, NULL, options, 0)); in htmlReadFile()
6661 htmlParserCtxtPtr ctxt; in htmlReadMemory() local
6664 ctxt = xmlCreateMemoryParserCtxt(buffer, size); in htmlReadMemory()
6665 if (ctxt == NULL) in htmlReadMemory()
6668 if (ctxt->sax != NULL) in htmlReadMemory()
6669 memcpy(ctxt->sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1)); in htmlReadMemory()
6670 return (htmlDoRead(ctxt, URL, encoding, options, 0)); in htmlReadMemory()
6687 htmlParserCtxtPtr ctxt; in htmlReadFd() local
6698 ctxt = xmlNewParserCtxt(); in htmlReadFd()
6699 if (ctxt == NULL) { in htmlReadFd()
6703 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in htmlReadFd()
6706 xmlFreeParserCtxt(ctxt); in htmlReadFd()
6709 inputPush(ctxt, stream); in htmlReadFd()
6710 return (htmlDoRead(ctxt, URL, encoding, options, 0)); in htmlReadFd()
6730 htmlParserCtxtPtr ctxt; in htmlReadIO() local
6742 ctxt = htmlNewParserCtxt(); in htmlReadIO()
6743 if (ctxt == NULL) { in htmlReadIO()
6747 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in htmlReadIO()
6750 xmlFreeParserCtxt(ctxt); in htmlReadIO()
6753 inputPush(ctxt, stream); in htmlReadIO()
6754 return (htmlDoRead(ctxt, URL, encoding, options, 0)); in htmlReadIO()
6771 htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur, in htmlCtxtReadDoc() argument
6778 if (ctxt == NULL) in htmlCtxtReadDoc()
6781 htmlCtxtReset(ctxt); in htmlCtxtReadDoc()
6783 stream = xmlNewStringInputStream(ctxt, cur); in htmlCtxtReadDoc()
6787 inputPush(ctxt, stream); in htmlCtxtReadDoc()
6788 return (htmlDoRead(ctxt, URL, encoding, options, 1)); in htmlCtxtReadDoc()
6804 htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename, in htmlCtxtReadFile() argument
6811 if (ctxt == NULL) in htmlCtxtReadFile()
6814 htmlCtxtReset(ctxt); in htmlCtxtReadFile()
6816 stream = xmlLoadExternalEntity(filename, NULL, ctxt); in htmlCtxtReadFile()
6820 inputPush(ctxt, stream); in htmlCtxtReadFile()
6821 return (htmlDoRead(ctxt, NULL, encoding, options, 1)); in htmlCtxtReadFile()
6839 htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size, in htmlCtxtReadMemory() argument
6845 if (ctxt == NULL) in htmlCtxtReadMemory()
6850 htmlCtxtReset(ctxt); in htmlCtxtReadMemory()
6857 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in htmlCtxtReadMemory()
6863 inputPush(ctxt, stream); in htmlCtxtReadMemory()
6864 return (htmlDoRead(ctxt, URL, encoding, options, 1)); in htmlCtxtReadMemory()
6881 htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd, in htmlCtxtReadFd() argument
6889 if (ctxt == NULL) in htmlCtxtReadFd()
6892 htmlCtxtReset(ctxt); in htmlCtxtReadFd()
6898 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in htmlCtxtReadFd()
6903 inputPush(ctxt, stream); in htmlCtxtReadFd()
6904 return (htmlDoRead(ctxt, URL, encoding, options, 1)); in htmlCtxtReadFd()
6923 htmlCtxtReadIO(htmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, in htmlCtxtReadIO() argument
6933 if (ctxt == NULL) in htmlCtxtReadIO()
6936 htmlCtxtReset(ctxt); in htmlCtxtReadIO()
6942 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in htmlCtxtReadIO()
6947 inputPush(ctxt, stream); in htmlCtxtReadIO()
6948 return (htmlDoRead(ctxt, URL, encoding, options, 1)); in htmlCtxtReadIO()