Lines Matching refs:ctxt
87 xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info);
120 xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long size, in xmlParserEntityCheck() argument
125 if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE)) in xmlParserEntityCheck()
127 if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) in xmlParserEntityCheck()
139 if (ctxt->input != NULL) { in xmlParserEntityCheck()
140 consumed = ctxt->input->consumed + in xmlParserEntityCheck()
141 (ctxt->input->cur - ctxt->input->base); in xmlParserEntityCheck()
143 consumed += ctxt->sizeentities; in xmlParserEntityCheck()
146 (ctxt->nbentities * 3 < XML_PARSER_NON_LINEAR * consumed)) in xmlParserEntityCheck()
157 if (ctxt->input != NULL) { in xmlParserEntityCheck()
158 consumed = ctxt->input->consumed + in xmlParserEntityCheck()
159 (ctxt->input->cur - ctxt->input->base); in xmlParserEntityCheck()
161 consumed += ctxt->sizeentities; in xmlParserEntityCheck()
176 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); in xmlParserEntityCheck()
209 static xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt,
219 xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options,
232 xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity);
249 xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar * prefix, in xmlErrAttributeDup() argument
252 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlErrAttributeDup()
253 (ctxt->instate == XML_PARSER_EOF)) in xmlErrAttributeDup()
255 if (ctxt != NULL) in xmlErrAttributeDup()
256 ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED; in xmlErrAttributeDup()
259 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, in xmlErrAttributeDup()
264 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, in xmlErrAttributeDup()
269 if (ctxt != NULL) { in xmlErrAttributeDup()
270 ctxt->wellFormed = 0; in xmlErrAttributeDup()
271 if (ctxt->recovery == 0) in xmlErrAttributeDup()
272 ctxt->disableSAX = 1; in xmlErrAttributeDup()
285 xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info) in xmlFatalErr() argument
289 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlFatalErr()
290 (ctxt->instate == XML_PARSER_EOF)) in xmlFatalErr()
471 if (ctxt != NULL) in xmlFatalErr()
472 ctxt->errNo = error; in xmlFatalErr()
473 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, in xmlFatalErr()
476 if (ctxt != NULL) { in xmlFatalErr()
477 ctxt->wellFormed = 0; in xmlFatalErr()
478 if (ctxt->recovery == 0) in xmlFatalErr()
479 ctxt->disableSAX = 1; in xmlFatalErr()
492 xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlFatalErrMsg() argument
495 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlFatalErrMsg()
496 (ctxt->instate == XML_PARSER_EOF)) in xmlFatalErrMsg()
498 if (ctxt != NULL) in xmlFatalErrMsg()
499 ctxt->errNo = error; in xmlFatalErrMsg()
500 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, in xmlFatalErrMsg()
502 if (ctxt != NULL) { in xmlFatalErrMsg()
503 ctxt->wellFormed = 0; in xmlFatalErrMsg()
504 if (ctxt->recovery == 0) in xmlFatalErrMsg()
505 ctxt->disableSAX = 1; in xmlFatalErrMsg()
520 xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlWarningMsg() argument
525 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlWarningMsg()
526 (ctxt->instate == XML_PARSER_EOF)) in xmlWarningMsg()
528 if ((ctxt != NULL) && (ctxt->sax != NULL) && in xmlWarningMsg()
529 (ctxt->sax->initialized == XML_SAX2_MAGIC)) in xmlWarningMsg()
530 schannel = ctxt->sax->serror; in xmlWarningMsg()
531 if (ctxt != NULL) { in xmlWarningMsg()
533 (ctxt->sax) ? ctxt->sax->warning : NULL, in xmlWarningMsg()
534 ctxt->userData, in xmlWarningMsg()
535 ctxt, NULL, XML_FROM_PARSER, error, in xmlWarningMsg()
541 ctxt, NULL, XML_FROM_PARSER, error, in xmlWarningMsg()
558 xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlValidityError() argument
563 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlValidityError()
564 (ctxt->instate == XML_PARSER_EOF)) in xmlValidityError()
566 if (ctxt != NULL) { in xmlValidityError()
567 ctxt->errNo = error; in xmlValidityError()
568 if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) in xmlValidityError()
569 schannel = ctxt->sax->serror; in xmlValidityError()
571 if (ctxt != NULL) { in xmlValidityError()
573 ctxt->vctxt.error, ctxt->vctxt.userData, in xmlValidityError()
574 ctxt, NULL, XML_FROM_DTD, error, in xmlValidityError()
578 ctxt->valid = 0; in xmlValidityError()
581 ctxt, NULL, XML_FROM_DTD, error, in xmlValidityError()
598 xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlFatalErrMsgInt() argument
601 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlFatalErrMsgInt()
602 (ctxt->instate == XML_PARSER_EOF)) in xmlFatalErrMsgInt()
604 if (ctxt != NULL) in xmlFatalErrMsgInt()
605 ctxt->errNo = error; in xmlFatalErrMsgInt()
607 ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, in xmlFatalErrMsgInt()
609 if (ctxt != NULL) { in xmlFatalErrMsgInt()
610 ctxt->wellFormed = 0; in xmlFatalErrMsgInt()
611 if (ctxt->recovery == 0) in xmlFatalErrMsgInt()
612 ctxt->disableSAX = 1; in xmlFatalErrMsgInt()
628 xmlFatalErrMsgStrIntStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlFatalErrMsgStrIntStr() argument
632 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlFatalErrMsgStrIntStr()
633 (ctxt->instate == XML_PARSER_EOF)) in xmlFatalErrMsgStrIntStr()
635 if (ctxt != NULL) in xmlFatalErrMsgStrIntStr()
636 ctxt->errNo = error; in xmlFatalErrMsgStrIntStr()
638 ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, in xmlFatalErrMsgStrIntStr()
641 if (ctxt != NULL) { in xmlFatalErrMsgStrIntStr()
642 ctxt->wellFormed = 0; in xmlFatalErrMsgStrIntStr()
643 if (ctxt->recovery == 0) in xmlFatalErrMsgStrIntStr()
644 ctxt->disableSAX = 1; in xmlFatalErrMsgStrIntStr()
658 xmlFatalErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlFatalErrMsgStr() argument
661 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlFatalErrMsgStr()
662 (ctxt->instate == XML_PARSER_EOF)) in xmlFatalErrMsgStr()
664 if (ctxt != NULL) in xmlFatalErrMsgStr()
665 ctxt->errNo = error; in xmlFatalErrMsgStr()
666 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, in xmlFatalErrMsgStr()
670 if (ctxt != NULL) { in xmlFatalErrMsgStr()
671 ctxt->wellFormed = 0; in xmlFatalErrMsgStr()
672 if (ctxt->recovery == 0) in xmlFatalErrMsgStr()
673 ctxt->disableSAX = 1; in xmlFatalErrMsgStr()
687 xmlErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlErrMsgStr() argument
690 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlErrMsgStr()
691 (ctxt->instate == XML_PARSER_EOF)) in xmlErrMsgStr()
693 if (ctxt != NULL) in xmlErrMsgStr()
694 ctxt->errNo = error; in xmlErrMsgStr()
695 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, in xmlErrMsgStr()
712 xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlNsErr() argument
717 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlNsErr()
718 (ctxt->instate == XML_PARSER_EOF)) in xmlNsErr()
720 if (ctxt != NULL) in xmlNsErr()
721 ctxt->errNo = error; in xmlNsErr()
722 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, in xmlNsErr()
726 if (ctxt != NULL) in xmlNsErr()
727 ctxt->nsWellFormed = 0; in xmlNsErr()
741 xmlNsWarn(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlNsWarn() argument
746 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlNsWarn()
747 (ctxt->instate == XML_PARSER_EOF)) in xmlNsWarn()
749 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, in xmlNsWarn()
992 xmlDetectSAX2(xmlParserCtxtPtr ctxt) { in xmlDetectSAX2() argument
993 if (ctxt == NULL) return; in xmlDetectSAX2()
995 if ((ctxt->sax) && (ctxt->sax->initialized == XML_SAX2_MAGIC) && in xmlDetectSAX2()
996 ((ctxt->sax->startElementNs != NULL) || in xmlDetectSAX2()
997 (ctxt->sax->endElementNs != NULL))) ctxt->sax2 = 1; in xmlDetectSAX2()
999 ctxt->sax2 = 1; in xmlDetectSAX2()
1002 ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); in xmlDetectSAX2()
1003 ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); in xmlDetectSAX2()
1004 ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); in xmlDetectSAX2()
1005 if ((ctxt->str_xml==NULL) || (ctxt->str_xmlns==NULL) || in xmlDetectSAX2()
1006 (ctxt->str_xml_ns == NULL)) { in xmlDetectSAX2()
1007 xmlErrMemory(ctxt, NULL); in xmlDetectSAX2()
1070 xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, xmlChar *src, int *len) in xmlAttrNormalizeSpace2() argument
1077 if ((ctxt == NULL) || (src == NULL) || (len == NULL)) in xmlAttrNormalizeSpace2()
1103 xmlErrMemory(ctxt, NULL); in xmlAttrNormalizeSpace2()
1127 xmlAddDefAttrs(xmlParserCtxtPtr ctxt, in xmlAddDefAttrs() argument
1139 if (ctxt->attsSpecial != NULL) { in xmlAddDefAttrs()
1140 if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL) in xmlAddDefAttrs()
1144 if (ctxt->attsDefault == NULL) { in xmlAddDefAttrs()
1145 ctxt->attsDefault = xmlHashCreateDict(10, ctxt->dict); in xmlAddDefAttrs()
1146 if (ctxt->attsDefault == NULL) in xmlAddDefAttrs()
1156 name = xmlDictLookup(ctxt->dict, fullname, -1); in xmlAddDefAttrs()
1159 name = xmlDictLookup(ctxt->dict, name, -1); in xmlAddDefAttrs()
1160 prefix = xmlDictLookup(ctxt->dict, fullname, len); in xmlAddDefAttrs()
1166 defaults = xmlHashLookup2(ctxt->attsDefault, name, prefix); in xmlAddDefAttrs()
1174 if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, in xmlAddDefAttrs()
1188 if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, in xmlAddDefAttrs()
1201 name = xmlDictLookup(ctxt->dict, fullattr, -1); in xmlAddDefAttrs()
1204 name = xmlDictLookup(ctxt->dict, name, -1); in xmlAddDefAttrs()
1205 prefix = xmlDictLookup(ctxt->dict, fullattr, len); in xmlAddDefAttrs()
1212 value = xmlDictLookup(ctxt->dict, value, len); in xmlAddDefAttrs()
1215 if (ctxt->external) in xmlAddDefAttrs()
1224 xmlErrMemory(ctxt, NULL); in xmlAddDefAttrs()
1238 xmlAddSpecialAttr(xmlParserCtxtPtr ctxt, in xmlAddSpecialAttr() argument
1243 if (ctxt->attsSpecial == NULL) { in xmlAddSpecialAttr()
1244 ctxt->attsSpecial = xmlHashCreateDict(10, ctxt->dict); in xmlAddSpecialAttr()
1245 if (ctxt->attsSpecial == NULL) in xmlAddSpecialAttr()
1249 if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL) in xmlAddSpecialAttr()
1252 xmlHashAddEntry2(ctxt->attsSpecial, fullname, fullattr, in xmlAddSpecialAttr()
1257 xmlErrMemory(ctxt, NULL); in xmlAddSpecialAttr()
1270 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data; in xmlCleanSpecialAttrCallback() local
1273 xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL); in xmlCleanSpecialAttrCallback()
1286 xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt) in xmlCleanSpecialAttr() argument
1288 if (ctxt->attsSpecial == NULL) in xmlCleanSpecialAttr()
1291 xmlHashScanFull(ctxt->attsSpecial, xmlCleanSpecialAttrCallback, ctxt); in xmlCleanSpecialAttr()
1293 if (xmlHashSize(ctxt->attsSpecial) == 0) { in xmlCleanSpecialAttr()
1294 xmlHashFree(ctxt->attsSpecial, NULL); in xmlCleanSpecialAttr()
1295 ctxt->attsSpecial = NULL; in xmlCleanSpecialAttr()
1500 static xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
1516 nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL) in nsPush() argument
1518 if (ctxt->options & XML_PARSE_NSCLEAN) { in nsPush()
1520 for (i = 0;i < ctxt->nsNr;i += 2) { in nsPush()
1521 if (ctxt->nsTab[i] == prefix) { in nsPush()
1523 if (ctxt->nsTab[i + 1] == URL) in nsPush()
1530 if ((ctxt->nsMax == 0) || (ctxt->nsTab == NULL)) { in nsPush()
1531 ctxt->nsMax = 10; in nsPush()
1532 ctxt->nsNr = 0; in nsPush()
1533 ctxt->nsTab = (const xmlChar **) in nsPush()
1534 xmlMalloc(ctxt->nsMax * sizeof(xmlChar *)); in nsPush()
1535 if (ctxt->nsTab == NULL) { in nsPush()
1536 xmlErrMemory(ctxt, NULL); in nsPush()
1537 ctxt->nsMax = 0; in nsPush()
1540 } else if (ctxt->nsNr >= ctxt->nsMax) { in nsPush()
1542 ctxt->nsMax *= 2; in nsPush()
1543 tmp = (const xmlChar **) xmlRealloc((char *) ctxt->nsTab, in nsPush()
1544 ctxt->nsMax * sizeof(ctxt->nsTab[0])); in nsPush()
1546 xmlErrMemory(ctxt, NULL); in nsPush()
1547 ctxt->nsMax /= 2; in nsPush()
1550 ctxt->nsTab = tmp; in nsPush()
1552 ctxt->nsTab[ctxt->nsNr++] = prefix; in nsPush()
1553 ctxt->nsTab[ctxt->nsNr++] = URL; in nsPush()
1554 return (ctxt->nsNr); in nsPush()
1566 nsPop(xmlParserCtxtPtr ctxt, int nr) in nsPop() argument
1570 if (ctxt->nsTab == NULL) return(0); in nsPop()
1571 if (ctxt->nsNr < nr) { in nsPop()
1573 nr = ctxt->nsNr; in nsPop()
1575 if (ctxt->nsNr <= 0) in nsPop()
1579 ctxt->nsNr--; in nsPop()
1580 ctxt->nsTab[ctxt->nsNr] = NULL; in nsPop()
1587 xmlCtxtGrowAttrs(xmlParserCtxtPtr ctxt, int nr) { in xmlCtxtGrowAttrs() argument
1592 if (ctxt->atts == NULL) { in xmlCtxtGrowAttrs()
1597 ctxt->atts = atts; in xmlCtxtGrowAttrs()
1600 ctxt->attallocs = attallocs; in xmlCtxtGrowAttrs()
1601 ctxt->maxatts = maxatts; in xmlCtxtGrowAttrs()
1602 } else if (nr + 5 > ctxt->maxatts) { in xmlCtxtGrowAttrs()
1604 atts = (const xmlChar **) xmlRealloc((void *) ctxt->atts, in xmlCtxtGrowAttrs()
1607 ctxt->atts = atts; in xmlCtxtGrowAttrs()
1608 attallocs = (int *) xmlRealloc((void *) ctxt->attallocs, in xmlCtxtGrowAttrs()
1611 ctxt->attallocs = attallocs; in xmlCtxtGrowAttrs()
1612 ctxt->maxatts = maxatts; in xmlCtxtGrowAttrs()
1614 return(ctxt->maxatts); in xmlCtxtGrowAttrs()
1616 xmlErrMemory(ctxt, NULL); in xmlCtxtGrowAttrs()
1630 inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) in inputPush() argument
1632 if ((ctxt == NULL) || (value == NULL)) in inputPush()
1634 if (ctxt->inputNr >= ctxt->inputMax) { in inputPush()
1635 ctxt->inputMax *= 2; in inputPush()
1636 ctxt->inputTab = in inputPush()
1637 (xmlParserInputPtr *) xmlRealloc(ctxt->inputTab, in inputPush()
1638 ctxt->inputMax * in inputPush()
1639 sizeof(ctxt->inputTab[0])); in inputPush()
1640 if (ctxt->inputTab == NULL) { in inputPush()
1641 xmlErrMemory(ctxt, NULL); in inputPush()
1643 ctxt->inputMax /= 2; in inputPush()
1648 ctxt->inputTab[ctxt->inputNr] = value; in inputPush()
1649 ctxt->input = value; in inputPush()
1650 return (ctxt->inputNr++); in inputPush()
1661 inputPop(xmlParserCtxtPtr ctxt) in inputPop() argument
1665 if (ctxt == NULL) in inputPop()
1667 if (ctxt->inputNr <= 0) in inputPop()
1669 ctxt->inputNr--; in inputPop()
1670 if (ctxt->inputNr > 0) in inputPop()
1671 ctxt->input = ctxt->inputTab[ctxt->inputNr - 1]; in inputPop()
1673 ctxt->input = NULL; in inputPop()
1674 ret = ctxt->inputTab[ctxt->inputNr]; in inputPop()
1675 ctxt->inputTab[ctxt->inputNr] = NULL; in inputPop()
1688 nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) in nodePush() argument
1690 if (ctxt == NULL) return(0); in nodePush()
1691 if (ctxt->nodeNr >= ctxt->nodeMax) { in nodePush()
1694 tmp = (xmlNodePtr *) xmlRealloc(ctxt->nodeTab, in nodePush()
1695 ctxt->nodeMax * 2 * in nodePush()
1696 sizeof(ctxt->nodeTab[0])); in nodePush()
1698 xmlErrMemory(ctxt, NULL); in nodePush()
1701 ctxt->nodeTab = tmp; in nodePush()
1702 ctxt->nodeMax *= 2; in nodePush()
1704 if ((((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) && in nodePush()
1705 ((ctxt->options & XML_PARSE_HUGE) == 0)) { in nodePush()
1706 xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, in nodePush()
1709 ctxt->instate = XML_PARSER_EOF; in nodePush()
1712 ctxt->nodeTab[ctxt->nodeNr] = value; in nodePush()
1713 ctxt->node = value; in nodePush()
1714 return (ctxt->nodeNr++); in nodePush()
1726 nodePop(xmlParserCtxtPtr ctxt) in nodePop() argument
1730 if (ctxt == NULL) return(NULL); in nodePop()
1731 if (ctxt->nodeNr <= 0) in nodePop()
1733 ctxt->nodeNr--; in nodePop()
1734 if (ctxt->nodeNr > 0) in nodePop()
1735 ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1]; in nodePop()
1737 ctxt->node = NULL; in nodePop()
1738 ret = ctxt->nodeTab[ctxt->nodeNr]; in nodePop()
1739 ctxt->nodeTab[ctxt->nodeNr] = NULL; in nodePop()
1756 nameNsPush(xmlParserCtxtPtr ctxt, const xmlChar * value, in nameNsPush() argument
1759 if (ctxt->nameNr >= ctxt->nameMax) { in nameNsPush()
1762 ctxt->nameMax *= 2; in nameNsPush()
1763 tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab, in nameNsPush()
1764 ctxt->nameMax * in nameNsPush()
1765 sizeof(ctxt->nameTab[0])); in nameNsPush()
1767 ctxt->nameMax /= 2; in nameNsPush()
1770 ctxt->nameTab = tmp; in nameNsPush()
1771 tmp2 = (void **) xmlRealloc((void * *)ctxt->pushTab, in nameNsPush()
1772 ctxt->nameMax * 3 * in nameNsPush()
1773 sizeof(ctxt->pushTab[0])); in nameNsPush()
1775 ctxt->nameMax /= 2; in nameNsPush()
1778 ctxt->pushTab = tmp2; in nameNsPush()
1780 ctxt->nameTab[ctxt->nameNr] = value; in nameNsPush()
1781 ctxt->name = value; in nameNsPush()
1782 ctxt->pushTab[ctxt->nameNr * 3] = (void *) prefix; in nameNsPush()
1783 ctxt->pushTab[ctxt->nameNr * 3 + 1] = (void *) URI; in nameNsPush()
1784 ctxt->pushTab[ctxt->nameNr * 3 + 2] = (void *) (long) nsNr; in nameNsPush()
1785 return (ctxt->nameNr++); in nameNsPush()
1787 xmlErrMemory(ctxt, NULL); in nameNsPush()
1799 nameNsPop(xmlParserCtxtPtr ctxt) in nameNsPop() argument
1803 if (ctxt->nameNr <= 0) in nameNsPop()
1805 ctxt->nameNr--; in nameNsPop()
1806 if (ctxt->nameNr > 0) in nameNsPop()
1807 ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; in nameNsPop()
1809 ctxt->name = NULL; in nameNsPop()
1810 ret = ctxt->nameTab[ctxt->nameNr]; in nameNsPop()
1811 ctxt->nameTab[ctxt->nameNr] = NULL; in nameNsPop()
1826 namePush(xmlParserCtxtPtr ctxt, const xmlChar * value) in namePush() argument
1828 if (ctxt == NULL) return (-1); in namePush()
1830 if (ctxt->nameNr >= ctxt->nameMax) { in namePush()
1832 tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab, in namePush()
1833 ctxt->nameMax * 2 * in namePush()
1834 sizeof(ctxt->nameTab[0])); in namePush()
1838 ctxt->nameTab = tmp; in namePush()
1839 ctxt->nameMax *= 2; in namePush()
1841 ctxt->nameTab[ctxt->nameNr] = value; in namePush()
1842 ctxt->name = value; in namePush()
1843 return (ctxt->nameNr++); in namePush()
1845 xmlErrMemory(ctxt, NULL); in namePush()
1857 namePop(xmlParserCtxtPtr ctxt) in namePop() argument
1861 if ((ctxt == NULL) || (ctxt->nameNr <= 0)) in namePop()
1863 ctxt->nameNr--; in namePop()
1864 if (ctxt->nameNr > 0) in namePop()
1865 ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; in namePop()
1867 ctxt->name = NULL; in namePop()
1868 ret = ctxt->nameTab[ctxt->nameNr]; in namePop()
1869 ctxt->nameTab[ctxt->nameNr] = NULL; in namePop()
1873 static int spacePush(xmlParserCtxtPtr ctxt, int val) { in spacePush() argument
1874 if (ctxt->spaceNr >= ctxt->spaceMax) { in spacePush()
1877 ctxt->spaceMax *= 2; in spacePush()
1878 tmp = (int *) xmlRealloc(ctxt->spaceTab, in spacePush()
1879 ctxt->spaceMax * sizeof(ctxt->spaceTab[0])); in spacePush()
1881 xmlErrMemory(ctxt, NULL); in spacePush()
1882 ctxt->spaceMax /=2; in spacePush()
1885 ctxt->spaceTab = tmp; in spacePush()
1887 ctxt->spaceTab[ctxt->spaceNr] = val; in spacePush()
1888 ctxt->space = &ctxt->spaceTab[ctxt->spaceNr]; in spacePush()
1889 return(ctxt->spaceNr++); in spacePush()
1892 static int spacePop(xmlParserCtxtPtr ctxt) { in spacePop() argument
1894 if (ctxt->spaceNr <= 0) return(0); in spacePop()
1895 ctxt->spaceNr--; in spacePop()
1896 if (ctxt->spaceNr > 0) in spacePop()
1897 ctxt->space = &ctxt->spaceTab[ctxt->spaceNr - 1]; in spacePop()
1899 ctxt->space = &ctxt->spaceTab[0]; in spacePop()
1900 ret = ctxt->spaceTab[ctxt->spaceNr]; in spacePop()
1901 ctxt->spaceTab[ctxt->spaceNr] = -1; in spacePop()
1940 #define RAW (*ctxt->input->cur)
1941 #define CUR (*ctxt->input->cur)
1942 #define NXT(val) ctxt->input->cur[(val)]
1943 #define CUR_PTR ctxt->input->cur
1964 ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val); \
1965 if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
1966 if ((*ctxt->input->cur == 0) && \
1967 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) \
1968 xmlPopInput(ctxt); \
1974 if (*(ctxt->input->cur) == '\n') { \
1975 ctxt->input->line++; ctxt->input->col = 1; \
1976 } else ctxt->input->col++; \
1977 ctxt->nbChars++; \
1978 ctxt->input->cur++; \
1980 if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
1981 if ((*ctxt->input->cur == 0) && \
1982 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) \
1983 xmlPopInput(ctxt); \
1986 #define SHRINK if ((ctxt->progressive == 0) && \
1987 (ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
1988 (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
1989 xmlSHRINK (ctxt);
1991 static void xmlSHRINK (xmlParserCtxtPtr ctxt) { in xmlSHRINK() argument
1992 xmlParserInputShrink(ctxt->input); in xmlSHRINK()
1993 if ((*ctxt->input->cur == 0) && in xmlSHRINK()
1994 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) in xmlSHRINK()
1995 xmlPopInput(ctxt); in xmlSHRINK()
1998 #define GROW if ((ctxt->progressive == 0) && \
1999 (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \
2000 xmlGROW (ctxt);
2002 static void xmlGROW (xmlParserCtxtPtr ctxt) { in xmlGROW() argument
2003 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlGROW()
2004 if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0) && in xmlGROW()
2005 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) in xmlGROW()
2006 xmlPopInput(ctxt); in xmlGROW()
2009 #define SKIP_BLANKS xmlSkipBlankChars(ctxt)
2011 #define NEXT xmlNextChar(ctxt)
2014 ctxt->input->col++; \
2015 ctxt->input->cur++; \
2016 ctxt->nbChars++; \
2017 if (*ctxt->input->cur == 0) \
2018 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
2022 if (*(ctxt->input->cur) == '\n') { \
2023 ctxt->input->line++; ctxt->input->col = 1; \
2024 } else ctxt->input->col++; \
2025 ctxt->input->cur += l; \
2026 if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
2029 #define CUR_CHAR(l) xmlCurrentChar(ctxt, &l)
2030 #define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
2047 xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { in xmlSkipBlankChars() argument
2054 if ((ctxt->inputNr == 1) && (ctxt->instate != XML_PARSER_DTD)) { in xmlSkipBlankChars()
2059 cur = ctxt->input->cur; in xmlSkipBlankChars()
2062 ctxt->input->line++; ctxt->input->col = 1; in xmlSkipBlankChars()
2067 ctxt->input->cur = cur; in xmlSkipBlankChars()
2068 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlSkipBlankChars()
2069 cur = ctxt->input->cur; in xmlSkipBlankChars()
2072 ctxt->input->cur = cur; in xmlSkipBlankChars()
2082 while ((cur == 0) && (ctxt->inputNr > 1) && in xmlSkipBlankChars()
2083 (ctxt->instate != XML_PARSER_COMMENT)) { in xmlSkipBlankChars()
2084 xmlPopInput(ctxt); in xmlSkipBlankChars()
2090 if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); in xmlSkipBlankChars()
2112 xmlPopInput(xmlParserCtxtPtr ctxt) { in xmlPopInput() argument
2113 if ((ctxt == NULL) || (ctxt->inputNr <= 1)) return(0); in xmlPopInput()
2116 "Popping input %d\n", ctxt->inputNr); in xmlPopInput()
2117 xmlFreeInputStream(inputPop(ctxt)); in xmlPopInput()
2118 if ((*ctxt->input->cur == 0) && in xmlPopInput()
2119 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) in xmlPopInput()
2120 return(xmlPopInput(ctxt)); in xmlPopInput()
2134 xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { in xmlPushInput() argument
2139 if ((ctxt->input != NULL) && (ctxt->input->filename)) in xmlPushInput()
2141 "%s(%d): ", ctxt->input->filename, in xmlPushInput()
2142 ctxt->input->line); in xmlPushInput()
2144 "Pushing input %d : %.30s\n", ctxt->inputNr+1, input->cur); in xmlPushInput()
2146 ret = inputPush(ctxt, input); in xmlPushInput()
2167 xmlParseCharRef(xmlParserCtxtPtr ctxt) { in xmlParseCharRef() argument
2191 xmlFatalErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, NULL); in xmlParseCharRef()
2203 ctxt->input->col++; in xmlParseCharRef()
2204 ctxt->nbChars ++; in xmlParseCharRef()
2205 ctxt->input->cur++; in xmlParseCharRef()
2218 xmlFatalErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, NULL); in xmlParseCharRef()
2230 ctxt->input->col++; in xmlParseCharRef()
2231 ctxt->nbChars ++; in xmlParseCharRef()
2232 ctxt->input->cur++; in xmlParseCharRef()
2235 xmlFatalErr(ctxt, XML_ERR_INVALID_CHARREF, NULL); in xmlParseCharRef()
2246 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, in xmlParseCharRef()
2272 xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { in xmlParseStringCharRef() argument
2292 xmlFatalErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, NULL); in xmlParseStringCharRef()
2311 xmlFatalErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, NULL); in xmlParseStringCharRef()
2324 xmlFatalErr(ctxt, XML_ERR_INVALID_CHARREF, NULL); in xmlParseStringCharRef()
2337 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, in xmlParseStringCharRef()
2358 xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { in xmlNewBlanksWrapperInputStream() argument
2363 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlNewBlanksWrapperInputStream()
2370 input = xmlNewInputStream(ctxt); in xmlNewBlanksWrapperInputStream()
2377 xmlErrMemory(ctxt, NULL); in xmlNewBlanksWrapperInputStream()
2428 xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { in xmlParserHandlePEReference() argument
2434 switch(ctxt->instate) { in xmlParserHandlePEReference()
2444 xmlFatalErr(ctxt, XML_ERR_PEREF_AT_EOF, NULL); in xmlParserHandlePEReference()
2449 xmlFatalErr(ctxt, XML_ERR_PEREF_IN_PROLOG, NULL); in xmlParserHandlePEReference()
2460 xmlFatalErr(ctxt, XML_ERR_PEREF_IN_EPILOG, NULL); in xmlParserHandlePEReference()
2479 if ((ctxt->external == 0) && (ctxt->inputNr == 1)) in xmlParserHandlePEReference()
2489 name = xmlParseName(ctxt); in xmlParserHandlePEReference()
2494 xmlFatalErr(ctxt, XML_ERR_PEREF_NO_NAME, NULL); in xmlParserHandlePEReference()
2498 if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL)) in xmlParserHandlePEReference()
2499 entity = ctxt->sax->getParameterEntity(ctxt->userData, name); in xmlParserHandlePEReference()
2510 if ((ctxt->standalone == 1) || in xmlParserHandlePEReference()
2511 ((ctxt->hasExternalSubset == 0) && in xmlParserHandlePEReference()
2512 (ctxt->hasPErefs == 0))) { in xmlParserHandlePEReference()
2513 xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, in xmlParserHandlePEReference()
2523 if ((ctxt->validate) && (ctxt->vctxt.error != NULL)) { in xmlParserHandlePEReference()
2524 xmlValidityError(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParserHandlePEReference()
2528 xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParserHandlePEReference()
2531 ctxt->valid = 0; in xmlParserHandlePEReference()
2533 } else if (ctxt->input->free != deallocblankswrapper) { in xmlParserHandlePEReference()
2534 input = xmlNewBlanksWrapperInputStream(ctxt, entity); in xmlParserHandlePEReference()
2535 if (xmlPushInput(ctxt, input) < 0) in xmlParserHandlePEReference()
2548 input = xmlNewEntityInputStream(ctxt, entity); in xmlParserHandlePEReference()
2549 if (xmlPushInput(ctxt, input) < 0) in xmlParserHandlePEReference()
2562 if ((ctxt->input->end - ctxt->input->cur)>=4) { in xmlParserHandlePEReference()
2569 xmlSwitchEncoding(ctxt, enc); in xmlParserHandlePEReference()
2576 xmlParseTextDecl(ctxt); in xmlParserHandlePEReference()
2579 xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, in xmlParserHandlePEReference()
2585 xmlFatalErr(ctxt, XML_ERR_PEREF_SEMICOL_MISSING, NULL); in xmlParserHandlePEReference()
2623 xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, in xmlStringLenDecodeEntities() argument
2635 if ((ctxt == NULL) || (str == NULL) || (len < 0)) in xmlStringLenDecodeEntities()
2639 if (((ctxt->depth > 40) && in xmlStringLenDecodeEntities()
2640 ((ctxt->options & XML_PARSE_HUGE) == 0)) || in xmlStringLenDecodeEntities()
2641 (ctxt->depth > 1024)) { in xmlStringLenDecodeEntities()
2642 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); in xmlStringLenDecodeEntities()
2666 int val = xmlParseStringCharRef(ctxt, &str); in xmlStringLenDecodeEntities()
2678 ent = xmlParseStringEntityRef(ctxt, &str); in xmlStringLenDecodeEntities()
2679 if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) || in xmlStringLenDecodeEntities()
2680 (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) in xmlStringLenDecodeEntities()
2683 ctxt->nbentities += ent->checked; in xmlStringLenDecodeEntities()
2692 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlStringLenDecodeEntities()
2696 ctxt->depth++; in xmlStringLenDecodeEntities()
2697 rep = xmlStringDecodeEntities(ctxt, ent->content, what, in xmlStringLenDecodeEntities()
2699 ctxt->depth--; in xmlStringLenDecodeEntities()
2707 if (xmlParserEntityCheck(ctxt, nbchars, ent)) in xmlStringLenDecodeEntities()
2731 ent = xmlParseStringPEReference(ctxt, &str); in xmlStringLenDecodeEntities()
2732 if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) in xmlStringLenDecodeEntities()
2735 ctxt->nbentities += ent->checked; in xmlStringLenDecodeEntities()
2738 xmlLoadEntityContent(ctxt, ent); in xmlStringLenDecodeEntities()
2740 ctxt->depth++; in xmlStringLenDecodeEntities()
2741 rep = xmlStringDecodeEntities(ctxt, ent->content, what, in xmlStringLenDecodeEntities()
2743 ctxt->depth--; in xmlStringLenDecodeEntities()
2750 if (xmlParserEntityCheck(ctxt, nbchars, ent)) in xmlStringLenDecodeEntities()
2775 xmlErrMemory(ctxt, NULL); in xmlStringLenDecodeEntities()
2803 xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what, in xmlStringDecodeEntities() argument
2805 if ((ctxt == NULL) || (str == NULL)) return(NULL); in xmlStringDecodeEntities()
2806 return(xmlStringLenDecodeEntities(ctxt, str, xmlStrlen(str), what, in xmlStringDecodeEntities()
2828 static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, in areBlanks() argument
2837 if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters) in areBlanks()
2843 if ((ctxt->space == NULL) || (*(ctxt->space) == 1) || in areBlanks()
2844 (*(ctxt->space) == -2)) in areBlanks()
2858 if (ctxt->node == NULL) return(0); in areBlanks()
2859 if (ctxt->myDoc != NULL) { in areBlanks()
2860 ret = xmlIsMixedElement(ctxt->myDoc, ctxt->node->name); in areBlanks()
2869 if ((ctxt->node->children == NULL) && in areBlanks()
2872 lastChild = xmlGetLastChild(ctxt->node); in areBlanks()
2874 if ((ctxt->node->type != XML_ELEMENT_NODE) && in areBlanks()
2875 (ctxt->node->content != NULL)) return(0); in areBlanks()
2878 else if ((ctxt->node->children != NULL) && in areBlanks()
2879 (xmlNodeIsText(ctxt->node->children))) in areBlanks()
2910 xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { in xmlSplitQName() argument
2949 xmlErrMemory(ctxt, NULL); in xmlSplitQName()
2962 xmlErrMemory(ctxt, NULL); in xmlSplitQName()
3008 xmlFatalErrMsgStr(ctxt, XML_NS_ERR_QNAME, in xmlSplitQName()
3028 xmlErrMemory(ctxt, NULL); in xmlSplitQName()
3040 xmlErrMemory(ctxt, NULL); in xmlSplitQName()
3094 xmlIsNameStartChar(xmlParserCtxtPtr ctxt, int c) { in xmlIsNameStartChar() argument
3095 if ((ctxt->options & XML_PARSE_OLD10) == 0) { in xmlIsNameStartChar()
3125 xmlIsNameChar(xmlParserCtxtPtr ctxt, int c) { in xmlIsNameChar() argument
3126 if ((ctxt->options & XML_PARSE_OLD10) == 0) { in xmlIsNameChar()
3163 static xmlChar * xmlParseAttValueInternal(xmlParserCtxtPtr ctxt,
3167 xmlParseNameComplex(xmlParserCtxtPtr ctxt) { in xmlParseNameComplex() argument
3181 if ((ctxt->options & XML_PARSE_OLD10) == 0) { in xmlParseNameComplex()
3261 if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) in xmlParseNameComplex()
3262 return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len)); in xmlParseNameComplex()
3263 return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); in xmlParseNameComplex()
3283 xmlParseName(xmlParserCtxtPtr ctxt) { in xmlParseName() argument
3297 in = ctxt->input->cur; in xmlParseName()
3309 count = in - ctxt->input->cur; in xmlParseName()
3310 ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); in xmlParseName()
3311 ctxt->input->cur = in; in xmlParseName()
3312 ctxt->nbChars += count; in xmlParseName()
3313 ctxt->input->col += count; in xmlParseName()
3315 xmlErrMemory(ctxt, NULL); in xmlParseName()
3320 return(xmlParseNameComplex(ctxt)); in xmlParseName()
3324 xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { in xmlParseNCNameComplex() argument
3339 (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) { in xmlParseNCNameComplex()
3344 (xmlIsNameChar(ctxt, c) && (c != ':'))) { in xmlParseNCNameComplex()
3353 return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); in xmlParseNCNameComplex()
3372 xmlParseNCName(xmlParserCtxtPtr ctxt) { in xmlParseNCName() argument
3384 in = ctxt->input->cur; in xmlParseNCName()
3396 count = in - ctxt->input->cur; in xmlParseNCName()
3397 ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); in xmlParseNCName()
3398 ctxt->input->cur = in; in xmlParseNCName()
3399 ctxt->nbChars += count; in xmlParseNCName()
3400 ctxt->input->col += count; in xmlParseNCName()
3402 xmlErrMemory(ctxt, NULL); in xmlParseNCName()
3407 return(xmlParseNCNameComplex(ctxt)); in xmlParseNCName()
3422 xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) { in xmlParseNameAndCompare() argument
3429 in = ctxt->input->cur; in xmlParseNameAndCompare()
3433 ctxt->input->col++; in xmlParseNameAndCompare()
3437 ctxt->input->cur = in; in xmlParseNameAndCompare()
3441 ret = xmlParseName (ctxt); in xmlParseNameAndCompare()
3468 xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { in xmlParseStringName() argument
3479 if (!xmlIsNameStartChar(ctxt, c)) { in xmlParseStringName()
3486 while (xmlIsNameChar(ctxt, c)) { in xmlParseStringName()
3500 xmlErrMemory(ctxt, NULL); in xmlParseStringName()
3504 while (xmlIsNameChar(ctxt, c)) { in xmlParseStringName()
3511 xmlErrMemory(ctxt, NULL); in xmlParseStringName()
3544 xmlParseNmtoken(xmlParserCtxtPtr ctxt) { in xmlParseNmtoken() argument
3557 while (xmlIsNameChar(ctxt, c)) { in xmlParseNmtoken()
3575 xmlErrMemory(ctxt, NULL); in xmlParseNmtoken()
3579 while (xmlIsNameChar(ctxt, c)) { in xmlParseNmtoken()
3591 xmlErrMemory(ctxt, NULL); in xmlParseNmtoken()
3624 xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { in xmlParseEntityValue() argument
3637 xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_STARTED, NULL); in xmlParseEntityValue()
3642 xmlErrMemory(ctxt, NULL); in xmlParseEntityValue()
3650 ctxt->instate = XML_PARSER_ENTITY_VALUE; in xmlParseEntityValue()
3651 input = ctxt->input; in xmlParseEntityValue()
3665 (ctxt->input != input))) { in xmlParseEntityValue()
3672 xmlErrMemory(ctxt, NULL); in xmlParseEntityValue()
3683 while ((RAW == 0) && (ctxt->inputNr > 1)) /* non input consuming */ in xmlParseEntityValue()
3684 xmlPopInput(ctxt); in xmlParseEntityValue()
3707 name = xmlParseStringName(ctxt, &cur); in xmlParseEntityValue()
3709 xmlFatalErrMsgInt(ctxt, XML_ERR_ENTITY_CHAR_ERROR, in xmlParseEntityValue()
3713 if ((tmp == '%') && (ctxt->inSubset == 1) && in xmlParseEntityValue()
3714 (ctxt->inputNr == 1)) { in xmlParseEntityValue()
3715 xmlFatalErr(ctxt, XML_ERR_ENTITY_PE_INTERNAL, NULL); in xmlParseEntityValue()
3729 xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_FINISHED, NULL); in xmlParseEntityValue()
3739 ret = xmlStringDecodeEntities(ctxt, buf, XML_SUBSTITUTE_PEREF, in xmlParseEntityValue()
3763 xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { in xmlParseAttValueComplex() argument
3774 ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; in xmlParseAttValueComplex()
3779 ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; in xmlParseAttValueComplex()
3782 xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); in xmlParseAttValueComplex()
3803 int val = xmlParseCharRef(ctxt); in xmlParseAttValueComplex()
3806 if (ctxt->replaceEntities) { in xmlParseAttValueComplex()
3832 ent = xmlParseEntityRef(ctxt); in xmlParseAttValueComplex()
3833 ctxt->nbentities++; in xmlParseAttValueComplex()
3835 ctxt->nbentities += ent->owner; in xmlParseAttValueComplex()
3841 if ((ctxt->replaceEntities == 0) && in xmlParseAttValueComplex()
3852 (ctxt->replaceEntities != 0)) { in xmlParseAttValueComplex()
3854 rep = xmlStringDecodeEntities(ctxt, ent->content, in xmlParseAttValueComplex()
3890 rep = xmlStringDecodeEntities(ctxt, ent->content, in xmlParseAttValueComplex()
3938 xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL); in xmlParseAttValueComplex()
3941 xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR, in xmlParseAttValueComplex()
3944 xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, in xmlParseAttValueComplex()
3953 xmlErrMemory(ctxt, NULL); in xmlParseAttValueComplex()
3996 xmlParseAttValue(xmlParserCtxtPtr ctxt) { in xmlParseAttValue() argument
3997 if ((ctxt == NULL) || (ctxt->input == NULL)) return(NULL); in xmlParseAttValue()
3998 return(xmlParseAttValueInternal(ctxt, NULL, NULL, 0)); in xmlParseAttValue()
4013 xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { in xmlParseSystemLiteral() argument
4019 int state = ctxt->instate; in xmlParseSystemLiteral()
4030 xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); in xmlParseSystemLiteral()
4036 xmlErrMemory(ctxt, NULL); in xmlParseSystemLiteral()
4039 ctxt->instate = XML_PARSER_SYSTEM_LITERAL; in xmlParseSystemLiteral()
4049 xmlErrMemory(ctxt, NULL); in xmlParseSystemLiteral()
4050 ctxt->instate = (xmlParserInputState) state; in xmlParseSystemLiteral()
4070 ctxt->instate = (xmlParserInputState) state; in xmlParseSystemLiteral()
4072 xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); in xmlParseSystemLiteral()
4091 xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { in xmlParsePubidLiteral() argument
4098 xmlParserInputState oldstate = ctxt->instate; in xmlParsePubidLiteral()
4108 xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); in xmlParsePubidLiteral()
4113 xmlErrMemory(ctxt, NULL); in xmlParsePubidLiteral()
4116 ctxt->instate = XML_PARSER_PUBLIC_LITERAL; in xmlParsePubidLiteral()
4125 xmlErrMemory(ctxt, NULL); in xmlParsePubidLiteral()
4147 xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); in xmlParsePubidLiteral()
4151 ctxt->instate = oldstate; in xmlParsePubidLiteral()
4155 static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata);
4212 xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) { in xmlParseCharData() argument
4215 int line = ctxt->input->line; in xmlParseCharData()
4216 int col = ctxt->input->col; in xmlParseCharData()
4226 in = ctxt->input->cur; in xmlParseCharData()
4229 while (*in == 0x20) { in++; ctxt->input->col++; } in xmlParseCharData()
4232 ctxt->input->line++; ctxt->input->col = 1; in xmlParseCharData()
4238 nbchar = in - ctxt->input->cur; in xmlParseCharData()
4240 const xmlChar *tmp = ctxt->input->cur; in xmlParseCharData()
4241 ctxt->input->cur = in; in xmlParseCharData()
4243 if ((ctxt->sax != NULL) && in xmlParseCharData()
4244 (ctxt->sax->ignorableWhitespace != in xmlParseCharData()
4245 ctxt->sax->characters)) { in xmlParseCharData()
4246 if (areBlanks(ctxt, tmp, nbchar, 1)) { in xmlParseCharData()
4247 if (ctxt->sax->ignorableWhitespace != NULL) in xmlParseCharData()
4248 ctxt->sax->ignorableWhitespace(ctxt->userData, in xmlParseCharData()
4251 if (ctxt->sax->characters != NULL) in xmlParseCharData()
4252 ctxt->sax->characters(ctxt->userData, in xmlParseCharData()
4254 if (*ctxt->space == -1) in xmlParseCharData()
4255 *ctxt->space = -2; in xmlParseCharData()
4257 } else if ((ctxt->sax != NULL) && in xmlParseCharData()
4258 (ctxt->sax->characters != NULL)) { in xmlParseCharData()
4259 ctxt->sax->characters(ctxt->userData, in xmlParseCharData()
4267 ccol = ctxt->input->col; in xmlParseCharData()
4272 ctxt->input->col = ccol; in xmlParseCharData()
4275 ctxt->input->line++; ctxt->input->col = 1; in xmlParseCharData()
4282 xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL); in xmlParseCharData()
4283 ctxt->input->cur = in; in xmlParseCharData()
4287 ctxt->input->col++; in xmlParseCharData()
4290 nbchar = in - ctxt->input->cur; in xmlParseCharData()
4292 if ((ctxt->sax != NULL) && in xmlParseCharData()
4293 (ctxt->sax->ignorableWhitespace != in xmlParseCharData()
4294 ctxt->sax->characters) && in xmlParseCharData()
4295 (IS_BLANK_CH(*ctxt->input->cur))) { in xmlParseCharData()
4296 const xmlChar *tmp = ctxt->input->cur; in xmlParseCharData()
4297 ctxt->input->cur = in; in xmlParseCharData()
4299 if (areBlanks(ctxt, tmp, nbchar, 0)) { in xmlParseCharData()
4300 if (ctxt->sax->ignorableWhitespace != NULL) in xmlParseCharData()
4301 ctxt->sax->ignorableWhitespace(ctxt->userData, in xmlParseCharData()
4304 if (ctxt->sax->characters != NULL) in xmlParseCharData()
4305 ctxt->sax->characters(ctxt->userData, in xmlParseCharData()
4307 if (*ctxt->space == -1) in xmlParseCharData()
4308 *ctxt->space = -2; in xmlParseCharData()
4310 line = ctxt->input->line; in xmlParseCharData()
4311 col = ctxt->input->col; in xmlParseCharData()
4312 } else if (ctxt->sax != NULL) { in xmlParseCharData()
4313 if (ctxt->sax->characters != NULL) in xmlParseCharData()
4314 ctxt->sax->characters(ctxt->userData, in xmlParseCharData()
4315 ctxt->input->cur, nbchar); in xmlParseCharData()
4316 line = ctxt->input->line; in xmlParseCharData()
4317 col = ctxt->input->col; in xmlParseCharData()
4320 if (ctxt->instate != XML_PARSER_CONTENT) in xmlParseCharData()
4323 ctxt->input->cur = in; in xmlParseCharData()
4327 ctxt->input->cur = in; in xmlParseCharData()
4329 ctxt->input->line++; ctxt->input->col = 1; in xmlParseCharData()
4342 in = ctxt->input->cur; in xmlParseCharData()
4346 ctxt->input->line = line; in xmlParseCharData()
4347 ctxt->input->col = col; in xmlParseCharData()
4348 xmlParseCharDataComplex(ctxt, cdata); in xmlParseCharData()
4361 xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { in xmlParseCharDataComplex() argument
4377 xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL); in xmlParseCharDataComplex()
4387 if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { in xmlParseCharDataComplex()
4388 if (areBlanks(ctxt, buf, nbchar, 0)) { in xmlParseCharDataComplex()
4389 if (ctxt->sax->ignorableWhitespace != NULL) in xmlParseCharDataComplex()
4390 ctxt->sax->ignorableWhitespace(ctxt->userData, in xmlParseCharDataComplex()
4393 if (ctxt->sax->characters != NULL) in xmlParseCharDataComplex()
4394 ctxt->sax->characters(ctxt->userData, buf, nbchar); in xmlParseCharDataComplex()
4395 if ((ctxt->sax->characters != in xmlParseCharDataComplex()
4396 ctxt->sax->ignorableWhitespace) && in xmlParseCharDataComplex()
4397 (*ctxt->space == -1)) in xmlParseCharDataComplex()
4398 *ctxt->space = -2; in xmlParseCharDataComplex()
4403 if (ctxt->instate != XML_PARSER_CONTENT) in xmlParseCharDataComplex()
4419 if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { in xmlParseCharDataComplex()
4420 if (areBlanks(ctxt, buf, nbchar, 0)) { in xmlParseCharDataComplex()
4421 if (ctxt->sax->ignorableWhitespace != NULL) in xmlParseCharDataComplex()
4422 ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); in xmlParseCharDataComplex()
4424 if (ctxt->sax->characters != NULL) in xmlParseCharDataComplex()
4425 ctxt->sax->characters(ctxt->userData, buf, nbchar); in xmlParseCharDataComplex()
4426 if ((ctxt->sax->characters != ctxt->sax->ignorableWhitespace) && in xmlParseCharDataComplex()
4427 (*ctxt->space == -1)) in xmlParseCharDataComplex()
4428 *ctxt->space = -2; in xmlParseCharDataComplex()
4434 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, in xmlParseCharDataComplex()
4464 xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { in xmlParseExternalID() argument
4473 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseExternalID()
4477 URI = xmlParseSystemLiteral(ctxt); in xmlParseExternalID()
4479 xmlFatalErr(ctxt, XML_ERR_URI_REQUIRED, NULL); in xmlParseExternalID()
4484 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseExternalID()
4488 *publicID = xmlParsePubidLiteral(ctxt); in xmlParseExternalID()
4490 xmlFatalErr(ctxt, XML_ERR_PUBID_REQUIRED, NULL); in xmlParseExternalID()
4497 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseExternalID()
4516 URI = xmlParseSystemLiteral(ctxt); in xmlParseExternalID()
4518 xmlFatalErr(ctxt, XML_ERR_URI_REQUIRED, NULL); in xmlParseExternalID()
4539 xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { in xmlParseCommentComplex() argument
4546 inputid = ctxt->input->id; in xmlParseCommentComplex()
4553 xmlErrMemory(ctxt, NULL); in xmlParseCommentComplex()
4562 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, in xmlParseCommentComplex()
4573 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, in xmlParseCommentComplex()
4587 xmlFatalErr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, NULL); in xmlParseCommentComplex()
4595 xmlErrMemory(ctxt, NULL); in xmlParseCommentComplex()
4621 xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, in xmlParseCommentComplex()
4624 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, in xmlParseCommentComplex()
4628 if (inputid != ctxt->input->id) { in xmlParseCommentComplex()
4629 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseCommentComplex()
4633 if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) && in xmlParseCommentComplex()
4634 (!ctxt->disableSAX)) in xmlParseCommentComplex()
4635 ctxt->sax->comment(ctxt->userData, buf); in xmlParseCommentComplex()
4640 xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, in xmlParseCommentComplex()
4657 xmlParseComment(xmlParserCtxtPtr ctxt) { in xmlParseComment() argument
4671 state = ctxt->instate; in xmlParseComment()
4672 ctxt->instate = XML_PARSER_COMMENT; in xmlParseComment()
4673 inputid = ctxt->input->id; in xmlParseComment()
4682 in = ctxt->input->cur; in xmlParseComment()
4686 ctxt->input->line++; ctxt->input->col = 1; in xmlParseComment()
4691 ccol = ctxt->input->col; in xmlParseComment()
4698 ctxt->input->col = ccol; in xmlParseComment()
4701 ctxt->input->line++; ctxt->input->col = 1; in xmlParseComment()
4706 nbchar = in - ctxt->input->cur; in xmlParseComment()
4711 if ((ctxt->sax != NULL) && in xmlParseComment()
4712 (ctxt->sax->comment != NULL)) { in xmlParseComment()
4720 xmlErrMemory(ctxt, NULL); in xmlParseComment()
4721 ctxt->instate = state; in xmlParseComment()
4732 xmlErrMemory(ctxt, NULL); in xmlParseComment()
4733 ctxt->instate = state; in xmlParseComment()
4738 memcpy(&buf[len], ctxt->input->cur, nbchar); in xmlParseComment()
4743 ctxt->input->cur = in; in xmlParseComment()
4746 ctxt->input->line++; ctxt->input->col = 1; in xmlParseComment()
4751 ctxt->input->cur = in; in xmlParseComment()
4753 ctxt->input->line++; ctxt->input->col = 1; in xmlParseComment()
4760 in = ctxt->input->cur; in xmlParseComment()
4764 if (ctxt->input->id != inputid) { in xmlParseComment()
4765 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseComment()
4769 if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) && in xmlParseComment()
4770 (!ctxt->disableSAX)) { in xmlParseComment()
4772 ctxt->sax->comment(ctxt->userData, buf); in xmlParseComment()
4774 ctxt->sax->comment(ctxt->userData, BAD_CAST ""); in xmlParseComment()
4778 ctxt->instate = state; in xmlParseComment()
4782 xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, in xmlParseComment()
4786 xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, in xmlParseComment()
4789 ctxt->input->col++; in xmlParseComment()
4792 ctxt->input->col++; in xmlParseComment()
4796 xmlParseCommentComplex(ctxt, buf, len, size); in xmlParseComment()
4797 ctxt->instate = state; in xmlParseComment()
4814 xmlParsePITarget(xmlParserCtxtPtr ctxt) { in xmlParsePITarget() argument
4817 name = xmlParseName(ctxt); in xmlParsePITarget()
4825 xmlFatalErrMsg(ctxt, XML_ERR_RESERVED_XML_NAME, in xmlParsePITarget()
4829 xmlFatalErr(ctxt, XML_ERR_RESERVED_XML_NAME, NULL); in xmlParsePITarget()
4837 xmlWarningMsg(ctxt, XML_ERR_RESERVED_XML_NAME, in xmlParsePITarget()
4842 xmlNsErr(ctxt, XML_NS_ERR_COLON, in xmlParsePITarget()
4865 xmlParseCatalogPI(xmlParserCtxtPtr ctxt, const xmlChar *catalog) { in xmlParseCatalogPI() argument
4896 ctxt->catalogs = xmlCatalogAddLocal(ctxt->catalogs, URL); in xmlParseCatalogPI()
4902 xmlWarningMsg(ctxt, XML_WAR_CATALOG_PI, in xmlParseCatalogPI()
4922 xmlParsePI(xmlParserCtxtPtr ctxt) { in xmlParsePI() argument
4932 xmlParserInputPtr input = ctxt->input; in xmlParsePI()
4933 state = ctxt->instate; in xmlParsePI()
4934 ctxt->instate = XML_PARSER_PI; in xmlParsePI()
4945 target = xmlParsePITarget(ctxt); in xmlParsePI()
4948 if (input != ctxt->input) { in xmlParsePI()
4949 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParsePI()
4957 if ((ctxt->sax) && (!ctxt->disableSAX) && in xmlParsePI()
4958 (ctxt->sax->processingInstruction != NULL)) in xmlParsePI()
4959 ctxt->sax->processingInstruction(ctxt->userData, in xmlParsePI()
4961 if (ctxt->instate != XML_PARSER_EOF) in xmlParsePI()
4962 ctxt->instate = state; in xmlParsePI()
4967 xmlErrMemory(ctxt, NULL); in xmlParsePI()
4968 ctxt->instate = state; in xmlParsePI()
4973 xmlFatalErrMsgStr(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParsePI()
4986 xmlErrMemory(ctxt, NULL); in xmlParsePI()
4988 ctxt->instate = state; in xmlParsePI()
5009 xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, in xmlParsePI()
5012 if (input != ctxt->input) { in xmlParsePI()
5013 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParsePI()
5025 xmlParseCatalogPI(ctxt, buf); in xmlParsePI()
5033 if ((ctxt->sax) && (!ctxt->disableSAX) && in xmlParsePI()
5034 (ctxt->sax->processingInstruction != NULL)) in xmlParsePI()
5035 ctxt->sax->processingInstruction(ctxt->userData, in xmlParsePI()
5040 xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL); in xmlParsePI()
5042 if (ctxt->instate != XML_PARSER_EOF) in xmlParsePI()
5043 ctxt->instate = state; in xmlParsePI()
5064 xmlParseNotationDecl(xmlParserCtxtPtr ctxt) { in xmlParseNotationDecl() argument
5070 xmlParserInputPtr input = ctxt->input; in xmlParseNotationDecl()
5074 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseNotationDecl()
5080 name = xmlParseName(ctxt); in xmlParseNotationDecl()
5082 xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL); in xmlParseNotationDecl()
5086 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseNotationDecl()
5091 xmlNsErr(ctxt, XML_NS_ERR_COLON, in xmlParseNotationDecl()
5100 Systemid = xmlParseExternalID(ctxt, &Pubid, 0); in xmlParseNotationDecl()
5104 if (input != ctxt->input) { in xmlParseNotationDecl()
5105 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseNotationDecl()
5109 if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && in xmlParseNotationDecl()
5110 (ctxt->sax->notationDecl != NULL)) in xmlParseNotationDecl()
5111 ctxt->sax->notationDecl(ctxt->userData, name, Pubid, Systemid); in xmlParseNotationDecl()
5113 xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_FINISHED, NULL); in xmlParseNotationDecl()
5143 xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { in xmlParseEntityDecl() argument
5154 xmlParserInputPtr input = ctxt->input; in xmlParseEntityDecl()
5159 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseEntityDecl()
5167 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseEntityDecl()
5173 name = xmlParseName(ctxt); in xmlParseEntityDecl()
5175 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseEntityDecl()
5180 xmlNsErr(ctxt, XML_NS_ERR_COLON, in xmlParseEntityDecl()
5186 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseEntityDecl()
5190 ctxt->instate = XML_PARSER_ENTITY_DECL; in xmlParseEntityDecl()
5196 value = xmlParseEntityValue(ctxt, &orig); in xmlParseEntityDecl()
5198 if ((ctxt->sax != NULL) && in xmlParseEntityDecl()
5199 (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL)) in xmlParseEntityDecl()
5200 ctxt->sax->entityDecl(ctxt->userData, name, in xmlParseEntityDecl()
5205 URI = xmlParseExternalID(ctxt, &literal, 1); in xmlParseEntityDecl()
5207 xmlFatalErr(ctxt, XML_ERR_VALUE_REQUIRED, NULL); in xmlParseEntityDecl()
5214 xmlErrMsgStr(ctxt, XML_ERR_INVALID_URI, in xmlParseEntityDecl()
5227 xmlFatalErr(ctxt, XML_ERR_URI_FRAGMENT, NULL); in xmlParseEntityDecl()
5229 if ((ctxt->sax != NULL) && in xmlParseEntityDecl()
5230 (!ctxt->disableSAX) && in xmlParseEntityDecl()
5231 (ctxt->sax->entityDecl != NULL)) in xmlParseEntityDecl()
5232 ctxt->sax->entityDecl(ctxt->userData, name, in xmlParseEntityDecl()
5242 value = xmlParseEntityValue(ctxt, &orig); in xmlParseEntityDecl()
5243 if ((ctxt->sax != NULL) && in xmlParseEntityDecl()
5244 (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL)) in xmlParseEntityDecl()
5245 ctxt->sax->entityDecl(ctxt->userData, name, in xmlParseEntityDecl()
5251 if ((ctxt->myDoc == NULL) || in xmlParseEntityDecl()
5252 (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) { in xmlParseEntityDecl()
5253 if (ctxt->myDoc == NULL) { in xmlParseEntityDecl()
5254 ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE); in xmlParseEntityDecl()
5255 if (ctxt->myDoc == NULL) { in xmlParseEntityDecl()
5256 xmlErrMemory(ctxt, "New Doc failed"); in xmlParseEntityDecl()
5259 ctxt->myDoc->properties = XML_DOC_INTERNAL; in xmlParseEntityDecl()
5261 if (ctxt->myDoc->intSubset == NULL) in xmlParseEntityDecl()
5262 ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc, in xmlParseEntityDecl()
5265 xmlSAX2EntityDecl(ctxt, name, XML_INTERNAL_GENERAL_ENTITY, in xmlParseEntityDecl()
5269 URI = xmlParseExternalID(ctxt, &literal, 1); in xmlParseEntityDecl()
5271 xmlFatalErr(ctxt, XML_ERR_VALUE_REQUIRED, NULL); in xmlParseEntityDecl()
5278 xmlErrMsgStr(ctxt, XML_ERR_INVALID_URI, in xmlParseEntityDecl()
5291 xmlFatalErr(ctxt, XML_ERR_URI_FRAGMENT, NULL); in xmlParseEntityDecl()
5297 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseEntityDecl()
5304 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseEntityDecl()
5308 ndata = xmlParseName(ctxt); in xmlParseEntityDecl()
5309 if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && in xmlParseEntityDecl()
5310 (ctxt->sax->unparsedEntityDecl != NULL)) in xmlParseEntityDecl()
5311 ctxt->sax->unparsedEntityDecl(ctxt->userData, name, in xmlParseEntityDecl()
5314 if ((ctxt->sax != NULL) && in xmlParseEntityDecl()
5315 (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL)) in xmlParseEntityDecl()
5316 ctxt->sax->entityDecl(ctxt->userData, name, in xmlParseEntityDecl()
5323 if ((ctxt->replaceEntities != 0) && in xmlParseEntityDecl()
5324 ((ctxt->myDoc == NULL) || in xmlParseEntityDecl()
5325 (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE)))) { in xmlParseEntityDecl()
5326 if (ctxt->myDoc == NULL) { in xmlParseEntityDecl()
5327 ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE); in xmlParseEntityDecl()
5328 if (ctxt->myDoc == NULL) { in xmlParseEntityDecl()
5329 xmlErrMemory(ctxt, "New Doc failed"); in xmlParseEntityDecl()
5332 ctxt->myDoc->properties = XML_DOC_INTERNAL; in xmlParseEntityDecl()
5335 if (ctxt->myDoc->intSubset == NULL) in xmlParseEntityDecl()
5336 ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc, in xmlParseEntityDecl()
5338 xmlSAX2EntityDecl(ctxt, name, in xmlParseEntityDecl()
5347 xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED, in xmlParseEntityDecl()
5350 if (input != ctxt->input) { in xmlParseEntityDecl()
5351 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseEntityDecl()
5363 if ((ctxt->sax != NULL) && in xmlParseEntityDecl()
5364 (ctxt->sax->getParameterEntity != NULL)) in xmlParseEntityDecl()
5365 cur = ctxt->sax->getParameterEntity(ctxt->userData, name); in xmlParseEntityDecl()
5367 if ((ctxt->sax != NULL) && in xmlParseEntityDecl()
5368 (ctxt->sax->getEntity != NULL)) in xmlParseEntityDecl()
5369 cur = ctxt->sax->getEntity(ctxt->userData, name); in xmlParseEntityDecl()
5370 if ((cur == NULL) && (ctxt->userData==ctxt)) { in xmlParseEntityDecl()
5371 cur = xmlSAX2GetEntity(ctxt, name); in xmlParseEntityDecl()
5418 xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) { in xmlParseDefaultDecl() argument
5436 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseDefaultDecl()
5441 ret = xmlParseAttValue(ctxt); in xmlParseDefaultDecl()
5442 ctxt->instate = XML_PARSER_DTD; in xmlParseDefaultDecl()
5444 xmlFatalErrMsg(ctxt, (xmlParserErrors)ctxt->errNo, in xmlParseDefaultDecl()
5469 xmlParseNotationType(xmlParserCtxtPtr ctxt) { in xmlParseNotationType() argument
5474 xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL); in xmlParseNotationType()
5481 name = xmlParseName(ctxt); in xmlParseNotationType()
5483 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseNotationType()
5491 xmlValidityError(ctxt, XML_DTD_DUP_TOKEN, in xmlParseNotationType()
5494 if (!xmlDictOwns(ctxt->dict, name)) in xmlParseNotationType()
5515 xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_FINISHED, NULL); in xmlParseNotationType()
5539 xmlParseEnumerationType(xmlParserCtxtPtr ctxt) { in xmlParseEnumerationType() argument
5544 xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_STARTED, NULL); in xmlParseEnumerationType()
5551 name = xmlParseNmtoken(ctxt); in xmlParseEnumerationType()
5553 xmlFatalErr(ctxt, XML_ERR_NMTOKEN_REQUIRED, NULL); in xmlParseEnumerationType()
5559 xmlValidityError(ctxt, XML_DTD_DUP_TOKEN, in xmlParseEnumerationType()
5562 if (!xmlDictOwns(ctxt->dict, name)) in xmlParseEnumerationType()
5570 if (!xmlDictOwns(ctxt->dict, name)) in xmlParseEnumerationType()
5585 xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_FINISHED, NULL); in xmlParseEnumerationType()
5608 xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) { in xmlParseEnumeratedType() argument
5612 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseEnumeratedType()
5617 *tree = xmlParseNotationType(ctxt); in xmlParseEnumeratedType()
5621 *tree = xmlParseEnumerationType(ctxt); in xmlParseEnumeratedType()
5672 xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) { in xmlParseAttributeType() argument
5699 return(xmlParseEnumeratedType(ctxt, tree)); in xmlParseAttributeType()
5714 xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { in xmlParseAttributeListDecl() argument
5720 xmlParserInputPtr input = ctxt->input; in xmlParseAttributeListDecl()
5724 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseAttributeListDecl()
5728 elemName = xmlParseName(ctxt); in xmlParseAttributeListDecl()
5730 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseAttributeListDecl()
5744 attrName = xmlParseName(ctxt); in xmlParseAttributeListDecl()
5746 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseAttributeListDecl()
5752 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseAttributeListDecl()
5758 type = xmlParseAttributeType(ctxt, &tree); in xmlParseAttributeListDecl()
5765 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseAttributeListDecl()
5773 def = xmlParseDefaultDecl(ctxt, &defaultValue); in xmlParseAttributeListDecl()
5787 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseAttributeListDecl()
5798 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseAttributeListDecl()
5806 if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && in xmlParseAttributeListDecl()
5807 (ctxt->sax->attributeDecl != NULL)) in xmlParseAttributeListDecl()
5808 ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName, in xmlParseAttributeListDecl()
5813 if ((ctxt->sax2) && (defaultValue != NULL) && in xmlParseAttributeListDecl()
5816 xmlAddDefAttrs(ctxt, elemName, attrName, defaultValue); in xmlParseAttributeListDecl()
5818 if (ctxt->sax2) { in xmlParseAttributeListDecl()
5819 xmlAddSpecialAttr(ctxt, elemName, attrName, type); in xmlParseAttributeListDecl()
5826 if (input != ctxt->input) { in xmlParseAttributeListDecl()
5827 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseAttributeListDecl()
5856 xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) { in xmlParseElementMixedContentDecl() argument
5866 if ((ctxt->validate) && (ctxt->input->id != inputchk)) { in xmlParseElementMixedContentDecl()
5867 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseElementMixedContentDecl()
5872 ret = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_PCDATA); in xmlParseElementMixedContentDecl()
5882 ret = cur = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_PCDATA); in xmlParseElementMixedContentDecl()
5888 ret = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_OR); in xmlParseElementMixedContentDecl()
5895 n = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_OR); in xmlParseElementMixedContentDecl()
5897 n->c1 = xmlNewDocElementContent(ctxt->myDoc, elem, XML_ELEMENT_CONTENT_ELEMENT); in xmlParseElementMixedContentDecl()
5906 elem = xmlParseName(ctxt); in xmlParseElementMixedContentDecl()
5908 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseElementMixedContentDecl()
5910 xmlFreeDocElementContent(ctxt->myDoc, cur); in xmlParseElementMixedContentDecl()
5918 cur->c2 = xmlNewDocElementContent(ctxt->myDoc, elem, in xmlParseElementMixedContentDecl()
5925 if ((ctxt->validate) && (ctxt->input->id != inputchk)) { in xmlParseElementMixedContentDecl()
5926 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseElementMixedContentDecl()
5932 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementMixedContentDecl()
5933 xmlFatalErr(ctxt, XML_ERR_MIXED_NOT_STARTED, NULL); in xmlParseElementMixedContentDecl()
5938 xmlFatalErr(ctxt, XML_ERR_PCDATA_REQUIRED, NULL); in xmlParseElementMixedContentDecl()
5976 xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk, in xmlParseElementChildrenContentDeclPriv() argument
5982 if (((depth > 128) && ((ctxt->options & XML_PARSE_HUGE) == 0)) || in xmlParseElementChildrenContentDeclPriv()
5984 xmlFatalErrMsgInt(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED, in xmlParseElementChildrenContentDeclPriv()
5992 int inputid = ctxt->input->id; in xmlParseElementChildrenContentDeclPriv()
5997 cur = ret = xmlParseElementChildrenContentDeclPriv(ctxt, inputid, in xmlParseElementChildrenContentDeclPriv()
6002 elem = xmlParseName(ctxt); in xmlParseElementChildrenContentDeclPriv()
6004 xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, NULL); in xmlParseElementChildrenContentDeclPriv()
6007 cur = ret = xmlNewDocElementContent(ctxt->myDoc, elem, XML_ELEMENT_CONTENT_ELEMENT); in xmlParseElementChildrenContentDeclPriv()
6009 xmlErrMemory(ctxt, NULL); in xmlParseElementChildrenContentDeclPriv()
6040 xmlFatalErrMsgInt(ctxt, XML_ERR_SEPARATOR_REQUIRED, in xmlParseElementChildrenContentDeclPriv()
6044 xmlFreeDocElementContent(ctxt->myDoc, last); in xmlParseElementChildrenContentDeclPriv()
6046 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementChildrenContentDeclPriv()
6051 op = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_SEQ); in xmlParseElementChildrenContentDeclPriv()
6054 xmlFreeDocElementContent(ctxt->myDoc, last); in xmlParseElementChildrenContentDeclPriv()
6055 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementChildrenContentDeclPriv()
6080 xmlFatalErrMsgInt(ctxt, XML_ERR_SEPARATOR_REQUIRED, in xmlParseElementChildrenContentDeclPriv()
6084 xmlFreeDocElementContent(ctxt->myDoc, last); in xmlParseElementChildrenContentDeclPriv()
6086 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementChildrenContentDeclPriv()
6091 op = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_OR); in xmlParseElementChildrenContentDeclPriv()
6094 xmlFreeDocElementContent(ctxt->myDoc, last); in xmlParseElementChildrenContentDeclPriv()
6096 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementChildrenContentDeclPriv()
6115 xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED, NULL); in xmlParseElementChildrenContentDeclPriv()
6117 xmlFreeDocElementContent(ctxt->myDoc, last); in xmlParseElementChildrenContentDeclPriv()
6119 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementChildrenContentDeclPriv()
6126 int inputid = ctxt->input->id; in xmlParseElementChildrenContentDeclPriv()
6130 last = xmlParseElementChildrenContentDeclPriv(ctxt, inputid, in xmlParseElementChildrenContentDeclPriv()
6134 elem = xmlParseName(ctxt); in xmlParseElementChildrenContentDeclPriv()
6136 xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, NULL); in xmlParseElementChildrenContentDeclPriv()
6138 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementChildrenContentDeclPriv()
6141 last = xmlNewDocElementContent(ctxt->myDoc, elem, XML_ELEMENT_CONTENT_ELEMENT); in xmlParseElementChildrenContentDeclPriv()
6144 xmlFreeDocElementContent(ctxt->myDoc, ret); in xmlParseElementChildrenContentDeclPriv()
6168 if ((ctxt->validate) && (ctxt->input->id != inputchk)) { in xmlParseElementChildrenContentDeclPriv()
6169 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseElementChildrenContentDeclPriv()
6272 xmlParseElementChildrenContentDecl(xmlParserCtxtPtr ctxt, int inputchk) { in xmlParseElementChildrenContentDecl() argument
6274 return(xmlParseElementChildrenContentDeclPriv(ctxt, inputchk, 1)); in xmlParseElementChildrenContentDecl()
6292 xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name, in xmlParseElementContentDecl() argument
6296 int inputid = ctxt->input->id; in xmlParseElementContentDecl()
6302 xmlFatalErrMsgStr(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, in xmlParseElementContentDecl()
6310 tree = xmlParseElementMixedContentDecl(ctxt, inputid); in xmlParseElementContentDecl()
6313 tree = xmlParseElementChildrenContentDeclPriv(ctxt, inputid, 1); in xmlParseElementContentDecl()
6335 xmlParseElementDecl(xmlParserCtxtPtr ctxt) { in xmlParseElementDecl() argument
6342 xmlParserInputPtr input = ctxt->input; in xmlParseElementDecl()
6346 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseElementDecl()
6350 name = xmlParseName(ctxt); in xmlParseElementDecl()
6352 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseElementDecl()
6356 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseElementDecl()
6357 xmlPopInput(ctxt); in xmlParseElementDecl()
6359 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseElementDecl()
6377 ret = xmlParseElementContentDecl(ctxt, name, &content); in xmlParseElementDecl()
6382 if ((RAW == '%') && (ctxt->external == 0) && in xmlParseElementDecl()
6383 (ctxt->inputNr == 1)) { in xmlParseElementDecl()
6384 xmlFatalErrMsg(ctxt, XML_ERR_PEREF_IN_INT_SUBSET, in xmlParseElementDecl()
6387 xmlFatalErrMsg(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, in xmlParseElementDecl()
6397 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseElementDecl()
6398 xmlPopInput(ctxt); in xmlParseElementDecl()
6402 xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL); in xmlParseElementDecl()
6404 xmlFreeDocElementContent(ctxt->myDoc, content); in xmlParseElementDecl()
6407 if (input != ctxt->input) { in xmlParseElementDecl()
6408 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseElementDecl()
6413 if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && in xmlParseElementDecl()
6414 (ctxt->sax->elementDecl != NULL)) { in xmlParseElementDecl()
6417 ctxt->sax->elementDecl(ctxt->userData, name, ret, in xmlParseElementDecl()
6426 xmlFreeDocElementContent(ctxt->myDoc, content); in xmlParseElementDecl()
6429 xmlFreeDocElementContent(ctxt->myDoc, content); in xmlParseElementDecl()
6448 xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { in xmlParseConditionalSections() argument
6449 int id = ctxt->input->id; in xmlParseConditionalSections()
6457 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); in xmlParseConditionalSections()
6459 if (ctxt->input->id != id) { in xmlParseConditionalSections()
6460 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseConditionalSections()
6467 if ((ctxt->input != NULL) && (ctxt->input->filename)) in xmlParseConditionalSections()
6469 "%s(%d): ", ctxt->input->filename, in xmlParseConditionalSections()
6470 ctxt->input->line); in xmlParseConditionalSections()
6478 unsigned int cons = ctxt->input->consumed; in xmlParseConditionalSections()
6481 xmlParseConditionalSections(ctxt); in xmlParseConditionalSections()
6485 xmlParsePEReference(ctxt); in xmlParseConditionalSections()
6487 xmlParseMarkupDecl(ctxt); in xmlParseConditionalSections()
6492 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseConditionalSections()
6493 xmlPopInput(ctxt); in xmlParseConditionalSections()
6495 if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { in xmlParseConditionalSections()
6496 xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); in xmlParseConditionalSections()
6501 if ((ctxt->input != NULL) && (ctxt->input->filename)) in xmlParseConditionalSections()
6503 "%s(%d): ", ctxt->input->filename, in xmlParseConditionalSections()
6504 ctxt->input->line); in xmlParseConditionalSections()
6517 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); in xmlParseConditionalSections()
6519 if (ctxt->input->id != id) { in xmlParseConditionalSections()
6520 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseConditionalSections()
6527 if ((ctxt->input != NULL) && (ctxt->input->filename)) in xmlParseConditionalSections()
6529 "%s(%d): ", ctxt->input->filename, in xmlParseConditionalSections()
6530 ctxt->input->line); in xmlParseConditionalSections()
6539 state = ctxt->disableSAX; in xmlParseConditionalSections()
6540 instate = ctxt->instate; in xmlParseConditionalSections()
6541 if (ctxt->recovery == 0) ctxt->disableSAX = 1; in xmlParseConditionalSections()
6542 ctxt->instate = XML_PARSER_IGNORE; in xmlParseConditionalSections()
6558 ctxt->disableSAX = state; in xmlParseConditionalSections()
6559 ctxt->instate = instate; in xmlParseConditionalSections()
6562 if ((ctxt->input != NULL) && (ctxt->input->filename)) in xmlParseConditionalSections()
6564 "%s(%d): ", ctxt->input->filename, in xmlParseConditionalSections()
6565 ctxt->input->line); in xmlParseConditionalSections()
6571 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL); in xmlParseConditionalSections()
6578 xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL); in xmlParseConditionalSections()
6580 if (ctxt->input->id != id) { in xmlParseConditionalSections()
6581 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, in xmlParseConditionalSections()
6612 xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) { in xmlParseMarkupDecl() argument
6619 xmlParseElementDecl(ctxt); in xmlParseMarkupDecl()
6621 xmlParseEntityDecl(ctxt); in xmlParseMarkupDecl()
6624 xmlParseAttributeListDecl(ctxt); in xmlParseMarkupDecl()
6627 xmlParseNotationDecl(ctxt); in xmlParseMarkupDecl()
6630 xmlParseComment(ctxt); in xmlParseMarkupDecl()
6637 xmlParsePI(ctxt); in xmlParseMarkupDecl()
6644 if ((ctxt->external == 0) && (ctxt->inputNr == 1)) in xmlParseMarkupDecl()
6645 xmlParsePEReference(ctxt); in xmlParseMarkupDecl()
6651 if ((ctxt->external == 0) && (ctxt->inputNr > 1)) { in xmlParseMarkupDecl()
6653 xmlParseConditionalSections(ctxt); in xmlParseMarkupDecl()
6657 ctxt->instate = XML_PARSER_DTD; in xmlParseMarkupDecl()
6670 xmlParseTextDecl(xmlParserCtxtPtr ctxt) { in xmlParseTextDecl() argument
6680 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_STARTED, NULL); in xmlParseTextDecl()
6685 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseTextDecl()
6693 version = xmlParseVersionInfo(ctxt); in xmlParseTextDecl()
6698 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseTextDecl()
6702 ctxt->input->version = version; in xmlParseTextDecl()
6707 encoding = xmlParseEncodingDecl(ctxt); in xmlParseTextDecl()
6708 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { in xmlParseTextDecl()
6714 if ((encoding == NULL) && (ctxt->errNo == XML_ERR_OK)) { in xmlParseTextDecl()
6715 xmlFatalErrMsg(ctxt, XML_ERR_MISSING_ENCODING, in xmlParseTextDecl()
6724 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL); in xmlParseTextDecl()
6727 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL); in xmlParseTextDecl()
6746 xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, in xmlParseExternalSubset() argument
6748 xmlDetectSAX2(ctxt); in xmlParseExternalSubset()
6751 if ((ctxt->encoding == NULL) && in xmlParseExternalSubset()
6752 (ctxt->input->end - ctxt->input->cur >= 4)) { in xmlParseExternalSubset()
6762 xmlSwitchEncoding(ctxt, enc); in xmlParseExternalSubset()
6766 xmlParseTextDecl(ctxt); in xmlParseExternalSubset()
6767 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { in xmlParseExternalSubset()
6771 ctxt->instate = XML_PARSER_EOF; in xmlParseExternalSubset()
6775 if (ctxt->myDoc == NULL) { in xmlParseExternalSubset()
6776 ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0"); in xmlParseExternalSubset()
6777 if (ctxt->myDoc == NULL) { in xmlParseExternalSubset()
6778 xmlErrMemory(ctxt, "New Doc failed"); in xmlParseExternalSubset()
6781 ctxt->myDoc->properties = XML_DOC_INTERNAL; in xmlParseExternalSubset()
6783 if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL)) in xmlParseExternalSubset()
6784 xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID); in xmlParseExternalSubset()
6786 ctxt->instate = XML_PARSER_DTD; in xmlParseExternalSubset()
6787 ctxt->external = 1; in xmlParseExternalSubset()
6792 unsigned int cons = ctxt->input->consumed; in xmlParseExternalSubset()
6796 xmlParseConditionalSections(ctxt); in xmlParseExternalSubset()
6800 xmlParsePEReference(ctxt); in xmlParseExternalSubset()
6802 xmlParseMarkupDecl(ctxt); in xmlParseExternalSubset()
6807 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseExternalSubset()
6808 xmlPopInput(ctxt); in xmlParseExternalSubset()
6810 if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { in xmlParseExternalSubset()
6811 xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); in xmlParseExternalSubset()
6817 xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); in xmlParseExternalSubset()
6834 xmlParseReference(xmlParserCtxtPtr ctxt) { in xmlParseReference() argument
6852 int value = xmlParseCharRef(ctxt); in xmlParseReference()
6856 if (ctxt->charset != XML_CHAR_ENCODING_UTF8) { in xmlParseReference()
6865 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && in xmlParseReference()
6866 (!ctxt->disableSAX)) in xmlParseReference()
6867 ctxt->sax->characters(ctxt->userData, out, 1); in xmlParseReference()
6873 if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && in xmlParseReference()
6874 (!ctxt->disableSAX)) in xmlParseReference()
6875 ctxt->sax->reference(ctxt->userData, out); in xmlParseReference()
6883 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && in xmlParseReference()
6884 (!ctxt->disableSAX)) in xmlParseReference()
6885 ctxt->sax->characters(ctxt->userData, out, i); in xmlParseReference()
6893 ent = xmlParseEntityRef(ctxt); in xmlParseReference()
6895 if (!ctxt->wellFormed) in xmlParseReference()
6907 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && in xmlParseReference()
6908 (!ctxt->disableSAX)) in xmlParseReference()
6909 ctxt->sax->characters(ctxt->userData, val, xmlStrlen(val)); in xmlParseReference()
6919 unsigned long oldnbent = ctxt->nbentities; in xmlParseReference()
6927 if (ctxt->userData == ctxt) in xmlParseReference()
6930 user_data = ctxt->userData; in xmlParseReference()
6939 ctxt->depth++; in xmlParseReference()
6940 ret = xmlParseBalancedChunkMemoryInternal(ctxt, ent->content, in xmlParseReference()
6942 ctxt->depth--; in xmlParseReference()
6945 ctxt->depth++; in xmlParseReference()
6946 ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, ctxt->sax, in xmlParseReference()
6947 user_data, ctxt->depth, ent->URI, in xmlParseReference()
6949 ctxt->depth--; in xmlParseReference()
6952 xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseReference()
6960 ent->checked = ctxt->nbentities - oldnbent; in xmlParseReference()
6962 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); in xmlParseReference()
6966 if (xmlParserEntityCheck(ctxt, 0, ent)) { in xmlParseReference()
6976 if (ctxt->replaceEntities) { in xmlParseReference()
6983 (ctxt->parseMode == XML_PARSE_READER)) { in xmlParseReference()
6990 list->parent = (xmlNodePtr) ctxt->node; in xmlParseReference()
6991 list->doc = ctxt->myDoc; in xmlParseReference()
7018 xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, in xmlParseReference()
7027 ctxt->nbentities += ent->checked; in xmlParseReference()
7049 if (ctxt->userData == ctxt) in xmlParseReference()
7052 user_data = ctxt->userData; in xmlParseReference()
7055 ctxt->depth++; in xmlParseReference()
7056 ret = xmlParseBalancedChunkMemoryInternal(ctxt, in xmlParseReference()
7058 ctxt->depth--; in xmlParseReference()
7061 ctxt->depth++; in xmlParseReference()
7062 ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, in xmlParseReference()
7063 ctxt->sax, user_data, ctxt->depth, in xmlParseReference()
7065 ctxt->depth--; in xmlParseReference()
7068 xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseReference()
7072 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); in xmlParseReference()
7076 if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && in xmlParseReference()
7077 (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { in xmlParseReference()
7082 ctxt->sax->reference(ctxt->userData, ent->name); in xmlParseReference()
7090 if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && in xmlParseReference()
7091 (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { in xmlParseReference()
7095 ctxt->sax->reference(ctxt->userData, ent->name); in xmlParseReference()
7099 if ((ctxt->replaceEntities) || (ent->children == NULL)) { in xmlParseReference()
7113 if ((ctxt->node != NULL) && (ent->children != NULL)) { in xmlParseReference()
7122 (ctxt->parseMode == XML_PARSE_READER)) { in xmlParseReference()
7134 nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); in xmlParseReference()
7141 nw = xmlAddChild(ctxt->node, nw); in xmlParseReference()
7148 if ((ctxt->parseMode == XML_PARSE_READER) && in xmlParseReference()
7179 nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); in xmlParseReference()
7187 xmlAddChild(ctxt->node, cur); in xmlParseReference()
7207 nbktext = xmlDictLookup(ctxt->dict, BAD_CAST "nbktext", in xmlParseReference()
7214 xmlAddChildList(ctxt->node, ent->children); in xmlParseReference()
7221 ctxt->nodemem = 0; in xmlParseReference()
7222 ctxt->nodelen = 0; in xmlParseReference()
7257 xmlParseEntityRef(xmlParserCtxtPtr ctxt) { in xmlParseEntityRef() argument
7266 name = xmlParseName(ctxt); in xmlParseEntityRef()
7268 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseEntityRef()
7273 xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); in xmlParseEntityRef()
7281 if ((ctxt->options & XML_PARSE_OLDSAX) == 0) { in xmlParseEntityRef()
7290 ctxt->nbentities++; in xmlParseEntityRef()
7296 if (ctxt->sax != NULL) { in xmlParseEntityRef()
7297 if (ctxt->sax->getEntity != NULL) in xmlParseEntityRef()
7298 ent = ctxt->sax->getEntity(ctxt->userData, name); in xmlParseEntityRef()
7299 if ((ctxt->wellFormed == 1 ) && (ent == NULL) && in xmlParseEntityRef()
7300 (ctxt->options & XML_PARSE_OLDSAX)) in xmlParseEntityRef()
7302 if ((ctxt->wellFormed == 1 ) && (ent == NULL) && in xmlParseEntityRef()
7303 (ctxt->userData==ctxt)) { in xmlParseEntityRef()
7304 ent = xmlSAX2GetEntity(ctxt, name); in xmlParseEntityRef()
7329 if ((ctxt->standalone == 1) || in xmlParseEntityRef()
7330 ((ctxt->hasExternalSubset == 0) && in xmlParseEntityRef()
7331 (ctxt->hasPErefs == 0))) { in xmlParseEntityRef()
7332 xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, in xmlParseEntityRef()
7335 xmlErrMsgStr(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParseEntityRef()
7337 if ((ctxt->inSubset == 0) && in xmlParseEntityRef()
7338 (ctxt->sax != NULL) && in xmlParseEntityRef()
7339 (ctxt->sax->reference != NULL)) { in xmlParseEntityRef()
7340 ctxt->sax->reference(ctxt->userData, name); in xmlParseEntityRef()
7343 ctxt->valid = 0; in xmlParseEntityRef()
7352 xmlFatalErrMsgStr(ctxt, XML_ERR_UNPARSED_ENTITY, in xmlParseEntityRef()
7361 else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && in xmlParseEntityRef()
7363 xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL, in xmlParseEntityRef()
7372 else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && in xmlParseEntityRef()
7376 xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, in xmlParseEntityRef()
7387 xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, in xmlParseEntityRef()
7437 xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { in xmlParseStringEntityRef() argument
7451 name = xmlParseStringName(ctxt, &ptr); in xmlParseStringEntityRef()
7453 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseStringEntityRef()
7459 xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); in xmlParseStringEntityRef()
7470 if ((ctxt->options & XML_PARSE_OLDSAX) == 0) { in xmlParseStringEntityRef()
7482 ctxt->nbentities++; in xmlParseStringEntityRef()
7488 if (ctxt->sax != NULL) { in xmlParseStringEntityRef()
7489 if (ctxt->sax->getEntity != NULL) in xmlParseStringEntityRef()
7490 ent = ctxt->sax->getEntity(ctxt->userData, name); in xmlParseStringEntityRef()
7491 if ((ent == NULL) && (ctxt->options & XML_PARSE_OLDSAX)) in xmlParseStringEntityRef()
7493 if ((ent == NULL) && (ctxt->userData==ctxt)) { in xmlParseStringEntityRef()
7494 ent = xmlSAX2GetEntity(ctxt, name); in xmlParseStringEntityRef()
7520 if ((ctxt->standalone == 1) || in xmlParseStringEntityRef()
7521 ((ctxt->hasExternalSubset == 0) && in xmlParseStringEntityRef()
7522 (ctxt->hasPErefs == 0))) { in xmlParseStringEntityRef()
7523 xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, in xmlParseStringEntityRef()
7526 xmlErrMsgStr(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParseStringEntityRef()
7539 xmlFatalErrMsgStr(ctxt, XML_ERR_UNPARSED_ENTITY, in xmlParseStringEntityRef()
7548 else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && in xmlParseStringEntityRef()
7550 xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL, in xmlParseStringEntityRef()
7559 else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && in xmlParseStringEntityRef()
7563 xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, in xmlParseStringEntityRef()
7575 xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, in xmlParseStringEntityRef()
7626 xmlParsePEReference(xmlParserCtxtPtr ctxt) in xmlParsePEReference() argument
7635 name = xmlParseName(ctxt); in xmlParsePEReference()
7637 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParsePEReference()
7642 xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); in xmlParsePEReference()
7651 ctxt->nbentities++; in xmlParsePEReference()
7656 if ((ctxt->sax != NULL) && in xmlParsePEReference()
7657 (ctxt->sax->getParameterEntity != NULL)) in xmlParsePEReference()
7658 entity = ctxt->sax->getParameterEntity(ctxt->userData, in xmlParsePEReference()
7669 if ((ctxt->standalone == 1) || in xmlParsePEReference()
7670 ((ctxt->hasExternalSubset == 0) && in xmlParsePEReference()
7671 (ctxt->hasPErefs == 0))) { in xmlParsePEReference()
7672 xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, in xmlParsePEReference()
7683 xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParsePEReference()
7686 ctxt->valid = 0; in xmlParsePEReference()
7694 xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParsePEReference()
7697 } else if (ctxt->input->free != deallocblankswrapper) { in xmlParsePEReference()
7698 input = xmlNewBlanksWrapperInputStream(ctxt, entity); in xmlParsePEReference()
7699 if (xmlPushInput(ctxt, input) < 0) in xmlParsePEReference()
7707 input = xmlNewEntityInputStream(ctxt, entity); in xmlParsePEReference()
7708 if (xmlPushInput(ctxt, input) < 0) in xmlParsePEReference()
7713 xmlParseTextDecl(ctxt); in xmlParsePEReference()
7714 if (ctxt->errNo == in xmlParsePEReference()
7720 ctxt->instate = XML_PARSER_EOF; in xmlParsePEReference()
7726 ctxt->hasPErefs = 1; in xmlParsePEReference()
7741 xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { in xmlLoadEntityContent() argument
7747 if ((ctxt == NULL) || (entity == NULL) || in xmlLoadEntityContent()
7751 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlLoadEntityContent()
7762 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlLoadEntityContent()
7767 input = xmlNewEntityInputStream(ctxt, entity); in xmlLoadEntityContent()
7769 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlLoadEntityContent()
7779 if (xmlPushInput(ctxt, input) < 0) { in xmlLoadEntityContent()
7786 while ((ctxt->input == input) && (ctxt->input->cur < ctxt->input->end) && in xmlLoadEntityContent()
7788 xmlBufferAdd(buf, ctxt->input->cur, l); in xmlLoadEntityContent()
7797 if ((ctxt->input == input) && (ctxt->input->cur >= ctxt->input->end)) { in xmlLoadEntityContent()
7798 xmlPopInput(ctxt); in xmlLoadEntityContent()
7800 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, in xmlLoadEntityContent()
7845 xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) { in xmlParseStringPEReference() argument
7857 name = xmlParseStringName(ctxt, &ptr); in xmlParseStringPEReference()
7859 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseStringPEReference()
7866 xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); in xmlParseStringPEReference()
7876 ctxt->nbentities++; in xmlParseStringPEReference()
7881 if ((ctxt->sax != NULL) && in xmlParseStringPEReference()
7882 (ctxt->sax->getParameterEntity != NULL)) in xmlParseStringPEReference()
7883 entity = ctxt->sax->getParameterEntity(ctxt->userData, in xmlParseStringPEReference()
7894 if ((ctxt->standalone == 1) || in xmlParseStringPEReference()
7895 ((ctxt->hasExternalSubset == 0) && (ctxt->hasPErefs == 0))) { in xmlParseStringPEReference()
7896 xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, in xmlParseStringPEReference()
7906 xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParseStringPEReference()
7909 ctxt->valid = 0; in xmlParseStringPEReference()
7917 xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, in xmlParseStringPEReference()
7922 ctxt->hasPErefs = 1; in xmlParseStringPEReference()
7943 xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt) { in xmlParseDocTypeDecl() argument
7958 name = xmlParseName(ctxt); in xmlParseDocTypeDecl()
7960 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseDocTypeDecl()
7963 ctxt->intSubName = name; in xmlParseDocTypeDecl()
7970 URI = xmlParseExternalID(ctxt, &ExternalID, 1); in xmlParseDocTypeDecl()
7973 ctxt->hasExternalSubset = 1; in xmlParseDocTypeDecl()
7975 ctxt->extSubURI = URI; in xmlParseDocTypeDecl()
7976 ctxt->extSubSystem = ExternalID; in xmlParseDocTypeDecl()
7983 if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) && in xmlParseDocTypeDecl()
7984 (!ctxt->disableSAX)) in xmlParseDocTypeDecl()
7985 ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI); in xmlParseDocTypeDecl()
7998 xmlFatalErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED, NULL); in xmlParseDocTypeDecl()
8013 xmlParseInternalSubset(xmlParserCtxtPtr ctxt) { in xmlParseInternalSubset() argument
8018 ctxt->instate = XML_PARSER_DTD; in xmlParseInternalSubset()
8027 unsigned int cons = ctxt->input->consumed; in xmlParseInternalSubset()
8030 xmlParseMarkupDecl(ctxt); in xmlParseInternalSubset()
8031 xmlParsePEReference(ctxt); in xmlParseInternalSubset()
8036 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseInternalSubset()
8037 xmlPopInput(ctxt); in xmlParseInternalSubset()
8039 if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { in xmlParseInternalSubset()
8040 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseInternalSubset()
8055 xmlFatalErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED, NULL); in xmlParseInternalSubset()
8095 xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) { in xmlParseAttribute() argument
8101 name = xmlParseName(ctxt); in xmlParseAttribute()
8103 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseAttribute()
8115 val = xmlParseAttValue(ctxt); in xmlParseAttribute()
8116 ctxt->instate = XML_PARSER_CONTENT; in xmlParseAttribute()
8118 xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, in xmlParseAttribute()
8128 if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "xml:lang"))) { in xmlParseAttribute()
8130 xmlWarningMsg(ctxt, XML_WAR_LANG_VALUE, in xmlParseAttribute()
8141 *(ctxt->space) = 0; in xmlParseAttribute()
8143 *(ctxt->space) = 1; in xmlParseAttribute()
8145 xmlWarningMsg(ctxt, XML_WAR_SPACE_VALUE, in xmlParseAttribute()
8184 xmlParseStartTag(xmlParserCtxtPtr ctxt) { in xmlParseStartTag() argument
8188 const xmlChar **atts = ctxt->atts; in xmlParseStartTag()
8190 int maxatts = ctxt->maxatts; in xmlParseStartTag()
8196 name = xmlParseName(ctxt); in xmlParseStartTag()
8198 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseStartTag()
8215 unsigned int cons = ctxt->input->consumed; in xmlParseStartTag()
8217 attname = xmlParseAttribute(ctxt, &attvalue); in xmlParseStartTag()
8226 xmlErrAttributeDup(ctxt, NULL, attname); in xmlParseStartTag()
8239 xmlErrMemory(ctxt, NULL); in xmlParseStartTag()
8244 ctxt->atts = atts; in xmlParseStartTag()
8245 ctxt->maxatts = maxatts; in xmlParseStartTag()
8253 xmlErrMemory(ctxt, NULL); in xmlParseStartTag()
8259 ctxt->atts = atts; in xmlParseStartTag()
8260 ctxt->maxatts = maxatts; in xmlParseStartTag()
8277 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseStartTag()
8281 if ((cons == ctxt->input->consumed) && (q == CUR_PTR) && in xmlParseStartTag()
8283 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseStartTag()
8294 if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL) && in xmlParseStartTag()
8295 (!ctxt->disableSAX)) { in xmlParseStartTag()
8297 ctxt->sax->startElement(ctxt->userData, name, atts); in xmlParseStartTag()
8299 ctxt->sax->startElement(ctxt->userData, name, NULL); in xmlParseStartTag()
8327 xmlParseEndTag1(xmlParserCtxtPtr ctxt, int line) { in xmlParseEndTag1() argument
8332 xmlFatalErrMsg(ctxt, XML_ERR_LTSLASH_REQUIRED, in xmlParseEndTag1()
8338 name = xmlParseNameAndCompare(ctxt,ctxt->name); in xmlParseEndTag1()
8346 xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL); in xmlParseEndTag1()
8358 xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NAME_MISMATCH, in xmlParseEndTag1()
8360 ctxt->name, line, name); in xmlParseEndTag1()
8366 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL) && in xmlParseEndTag1()
8367 (!ctxt->disableSAX)) in xmlParseEndTag1()
8368 ctxt->sax->endElement(ctxt->userData, ctxt->name); in xmlParseEndTag1()
8370 namePop(ctxt); in xmlParseEndTag1()
8371 spacePop(ctxt); in xmlParseEndTag1()
8389 xmlParseEndTag(xmlParserCtxtPtr ctxt) { in xmlParseEndTag() argument
8390 xmlParseEndTag1(ctxt, 0); in xmlParseEndTag()
8411 xmlGetNamespace(xmlParserCtxtPtr ctxt, const xmlChar *prefix) { in xmlGetNamespace() argument
8414 if (prefix == ctxt->str_xml) return(ctxt->str_xml_ns); in xmlGetNamespace()
8415 for (i = ctxt->nsNr - 2;i >= 0;i-=2) in xmlGetNamespace()
8416 if (ctxt->nsTab[i] == prefix) { in xmlGetNamespace()
8417 if ((prefix == NULL) && (*ctxt->nsTab[i + 1] == 0)) in xmlGetNamespace()
8419 return(ctxt->nsTab[i + 1]); in xmlGetNamespace()
8439 xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) { in xmlParseQName() argument
8444 l = xmlParseNCName(ctxt); in xmlParseQName()
8447 l = xmlParseName(ctxt); in xmlParseQName()
8449 xmlNsErr(ctxt, XML_NS_ERR_QNAME, in xmlParseQName()
8460 l = xmlParseNCName(ctxt); in xmlParseQName()
8464 xmlNsErr(ctxt, XML_NS_ERR_QNAME, in xmlParseQName()
8466 l = xmlParseNmtoken(ctxt); in xmlParseQName()
8473 p = xmlDictLookup(ctxt->dict, tmp, -1); in xmlParseQName()
8481 xmlNsErr(ctxt, XML_NS_ERR_QNAME, in xmlParseQName()
8484 tmp = (xmlChar *) xmlParseName(ctxt); in xmlParseQName()
8487 l = xmlDictLookup(ctxt->dict, tmp, -1); in xmlParseQName()
8493 l = xmlDictLookup(ctxt->dict, tmp, -1); in xmlParseQName()
8518 xmlParseQNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *name, in xmlParseQNameAndCompare() argument
8525 if (prefix == NULL) return(xmlParseNameAndCompare(ctxt, name)); in xmlParseQNameAndCompare()
8528 in = ctxt->input->cur; in xmlParseQNameAndCompare()
8544 ctxt->input->cur = in; in xmlParseQNameAndCompare()
8551 ret = xmlParseQName (ctxt, &prefix2); in xmlParseQNameAndCompare()
8592 xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, in xmlParseAttValueInternal() argument
8602 xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); in xmlParseAttValueInternal()
8605 ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; in xmlParseAttValueInternal()
8613 end = ctxt->input->end; in xmlParseAttValueInternal()
8616 const xmlChar *oldbase = ctxt->input->base; in xmlParseAttValueInternal()
8618 if (oldbase != ctxt->input->base) { in xmlParseAttValueInternal()
8619 long delta = ctxt->input->base - oldbase; in xmlParseAttValueInternal()
8623 end = ctxt->input->end; in xmlParseAttValueInternal()
8635 const xmlChar *oldbase = ctxt->input->base; in xmlParseAttValueInternal()
8637 if (oldbase != ctxt->input->base) { in xmlParseAttValueInternal()
8638 long delta = ctxt->input->base - oldbase; in xmlParseAttValueInternal()
8642 end = ctxt->input->end; in xmlParseAttValueInternal()
8649 const xmlChar *oldbase = ctxt->input->base; in xmlParseAttValueInternal()
8651 if (oldbase != ctxt->input->base) { in xmlParseAttValueInternal()
8652 long delta = ctxt->input->base - oldbase; in xmlParseAttValueInternal()
8656 end = ctxt->input->end; in xmlParseAttValueInternal()
8669 const xmlChar *oldbase = ctxt->input->base; in xmlParseAttValueInternal()
8671 if (oldbase != ctxt->input->base) { in xmlParseAttValueInternal()
8672 long delta = ctxt->input->base - oldbase; in xmlParseAttValueInternal()
8677 end = ctxt->input->end; in xmlParseAttValueInternal()
8686 const xmlChar *oldbase = ctxt->input->base; in xmlParseAttValueInternal()
8688 if (oldbase != ctxt->input->base) { in xmlParseAttValueInternal()
8689 long delta = ctxt->input->base - oldbase; in xmlParseAttValueInternal()
8693 end = ctxt->input->end; in xmlParseAttValueInternal()
8712 return xmlParseAttValueComplex(ctxt, len, normalize); in xmlParseAttValueInternal()
8731 xmlParseAttribute2(xmlParserCtxtPtr ctxt, in xmlParseAttribute2() argument
8742 name = xmlParseQName(ctxt, prefix); in xmlParseAttribute2()
8744 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseAttribute2()
8752 if (ctxt->attsSpecial != NULL) { in xmlParseAttribute2()
8755 type = (int) (long) xmlHashQLookup2(ctxt->attsSpecial, in xmlParseAttribute2()
8768 val = xmlParseAttValueInternal(ctxt, len, alloc, normalize); in xmlParseAttribute2()
8779 val2 = xmlAttrNormalizeSpace2(ctxt, val, len); in xmlParseAttribute2()
8786 ctxt->instate = XML_PARSER_CONTENT; in xmlParseAttribute2()
8788 xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, in xmlParseAttribute2()
8794 if (*prefix == ctxt->str_xml) { in xmlParseAttribute2()
8800 if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "lang"))) { in xmlParseAttribute2()
8803 xmlWarningMsg(ctxt, XML_WAR_LANG_VALUE, in xmlParseAttribute2()
8815 *(ctxt->space) = 0; in xmlParseAttribute2()
8817 *(ctxt->space) = 1; in xmlParseAttribute2()
8819 xmlWarningMsg(ctxt, XML_WAR_SPACE_VALUE, in xmlParseAttribute2()
8862 xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref, in xmlParseStartTag2() argument
8870 const xmlChar **atts = ctxt->atts; in xmlParseStartTag2()
8871 int maxatts = ctxt->maxatts; in xmlParseStartTag2()
8876 int nsNr = ctxt->nsNr; in xmlParseStartTag2()
8890 base = ctxt->input->base; in xmlParseStartTag2()
8891 cur = ctxt->input->cur - ctxt->input->base; in xmlParseStartTag2()
8892 oldline = ctxt->input->line; in xmlParseStartTag2()
8893 oldcol = ctxt->input->col; in xmlParseStartTag2()
8900 ctxt->nsNr = nsNr; in xmlParseStartTag2()
8902 localname = xmlParseQName(ctxt, &prefix); in xmlParseStartTag2()
8904 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, in xmlParseStartTag2()
8908 *tlen = ctxt->input->cur - ctxt->input->base - cur; in xmlParseStartTag2()
8917 if (ctxt->input->base != base) goto base_changed; in xmlParseStartTag2()
8923 unsigned int cons = ctxt->input->consumed; in xmlParseStartTag2()
8926 attname = xmlParseAttribute2(ctxt, prefix, localname, in xmlParseStartTag2()
8928 if (ctxt->input->base != base) { in xmlParseStartTag2()
8936 if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) { in xmlParseStartTag2()
8937 const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len); in xmlParseStartTag2()
8943 xmlNsErr(ctxt, XML_WAR_NS_URI, in xmlParseStartTag2()
8948 xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE, in xmlParseStartTag2()
8954 if (URL == ctxt->str_xml_ns) { in xmlParseStartTag2()
8955 if (attname != ctxt->str_xml) { in xmlParseStartTag2()
8956 xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, in xmlParseStartTag2()
8965 xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, in xmlParseStartTag2()
8975 if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL) in xmlParseStartTag2()
8978 xmlErrAttributeDup(ctxt, NULL, attname); in xmlParseStartTag2()
8980 if (nsPush(ctxt, NULL, URL) > 0) nbNs++; in xmlParseStartTag2()
8986 if (aprefix == ctxt->str_xmlns) { in xmlParseStartTag2()
8987 const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len); in xmlParseStartTag2()
8990 if (attname == ctxt->str_xml) { in xmlParseStartTag2()
8991 if (URL != ctxt->str_xml_ns) { in xmlParseStartTag2()
8992 xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, in xmlParseStartTag2()
9001 if (URL == ctxt->str_xml_ns) { in xmlParseStartTag2()
9002 if (attname != ctxt->str_xml) { in xmlParseStartTag2()
9003 xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, in xmlParseStartTag2()
9009 if (attname == ctxt->str_xmlns) { in xmlParseStartTag2()
9010 xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, in xmlParseStartTag2()
9018 xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, in xmlParseStartTag2()
9024 xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, in xmlParseStartTag2()
9031 xmlNsErr(ctxt, XML_WAR_NS_URI, in xmlParseStartTag2()
9035 if ((ctxt->pedantic) && (uri->scheme == NULL)) { in xmlParseStartTag2()
9036 xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE, in xmlParseStartTag2()
9048 if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname) in xmlParseStartTag2()
9051 xmlErrAttributeDup(ctxt, aprefix, attname); in xmlParseStartTag2()
9053 if (nsPush(ctxt, attname, URL) > 0) nbNs++; in xmlParseStartTag2()
9057 if (ctxt->input->base != base) goto base_changed; in xmlParseStartTag2()
9065 if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) { in xmlParseStartTag2()
9070 maxatts = ctxt->maxatts; in xmlParseStartTag2()
9071 atts = ctxt->atts; in xmlParseStartTag2()
9073 ctxt->attallocs[nratts++] = alloc; in xmlParseStartTag2()
9092 if (ctxt->input->base != base) goto base_changed; in xmlParseStartTag2()
9096 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseStartTag2()
9101 if ((cons == ctxt->input->consumed) && (q == CUR_PTR) && in xmlParseStartTag2()
9103 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseStartTag2()
9108 if (ctxt->input->base != base) goto base_changed; in xmlParseStartTag2()
9114 if (ctxt->attsDefault != NULL) { in xmlParseStartTag2()
9117 defaults = xmlHashLookup2(ctxt->attsDefault, localname, prefix); in xmlParseStartTag2()
9126 if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) { in xmlParseStartTag2()
9131 if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL) in xmlParseStartTag2()
9135 nsname = xmlGetNamespace(ctxt, NULL); in xmlParseStartTag2()
9137 if (nsPush(ctxt, NULL, in xmlParseStartTag2()
9141 } else if (aprefix == ctxt->str_xmlns) { in xmlParseStartTag2()
9146 if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname) in xmlParseStartTag2()
9150 nsname = xmlGetNamespace(ctxt, attname); in xmlParseStartTag2()
9152 if (nsPush(ctxt, attname, in xmlParseStartTag2()
9167 if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) { in xmlParseStartTag2()
9170 maxatts = ctxt->maxatts; in xmlParseStartTag2()
9171 atts = ctxt->atts; in xmlParseStartTag2()
9178 atts[nbatts++] = xmlGetNamespace(ctxt, aprefix); in xmlParseStartTag2()
9181 if ((ctxt->standalone == 1) && in xmlParseStartTag2()
9183 xmlValidityError(ctxt, XML_DTD_STANDALONE_DEFAULTED, in xmlParseStartTag2()
9201 nsname = xmlGetNamespace(ctxt, atts[i + 1]); in xmlParseStartTag2()
9203 xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlParseStartTag2()
9219 xmlErrAttributeDup(ctxt, atts[i+1], atts[i]); in xmlParseStartTag2()
9223 xmlNsErr(ctxt, XML_NS_ERR_ATTRIBUTE_REDEFINED, in xmlParseStartTag2()
9232 nsname = xmlGetNamespace(ctxt, prefix); in xmlParseStartTag2()
9234 xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlParseStartTag2()
9244 if ((ctxt->sax != NULL) && (ctxt->sax->startElementNs != NULL) && in xmlParseStartTag2()
9245 (!ctxt->disableSAX)) { in xmlParseStartTag2()
9247 ctxt->sax->startElementNs(ctxt->userData, localname, prefix, in xmlParseStartTag2()
9248 nsname, nbNs, &ctxt->nsTab[ctxt->nsNr - 2 * nbNs], in xmlParseStartTag2()
9251 ctxt->sax->startElementNs(ctxt->userData, localname, prefix, in xmlParseStartTag2()
9260 if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL)) in xmlParseStartTag2()
9272 if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL)) in xmlParseStartTag2()
9275 ctxt->input->cur = ctxt->input->base + cur; in xmlParseStartTag2()
9276 ctxt->input->line = oldline; in xmlParseStartTag2()
9277 ctxt->input->col = oldcol; in xmlParseStartTag2()
9278 if (ctxt->wellFormed == 1) { in xmlParseStartTag2()
9300 xmlParseEndTag2(xmlParserCtxtPtr ctxt, const xmlChar *prefix, in xmlParseEndTag2() argument
9306 xmlFatalErr(ctxt, XML_ERR_LTSLASH_REQUIRED, NULL); in xmlParseEndTag2()
9311 if ((tlen > 0) && (xmlStrncmp(ctxt->input->cur, ctxt->name, tlen) == 0)) { in xmlParseEndTag2()
9312 if (ctxt->input->cur[tlen] == '>') { in xmlParseEndTag2()
9313 ctxt->input->cur += tlen + 1; in xmlParseEndTag2()
9316 ctxt->input->cur += tlen; in xmlParseEndTag2()
9320 name = xmlParseNameAndCompare(ctxt, ctxt->name); in xmlParseEndTag2()
9322 name = xmlParseQNameAndCompare(ctxt, ctxt->name, prefix); in xmlParseEndTag2()
9331 xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL); in xmlParseEndTag2()
9343 if ((line == 0) && (ctxt->node != NULL)) in xmlParseEndTag2()
9344 line = ctxt->node->line; in xmlParseEndTag2()
9345 xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NAME_MISMATCH, in xmlParseEndTag2()
9347 ctxt->name, line, name); in xmlParseEndTag2()
9354 if ((ctxt->sax != NULL) && (ctxt->sax->endElementNs != NULL) && in xmlParseEndTag2()
9355 (!ctxt->disableSAX)) in xmlParseEndTag2()
9356 ctxt->sax->endElementNs(ctxt->userData, ctxt->name, prefix, URI); in xmlParseEndTag2()
9358 spacePop(ctxt); in xmlParseEndTag2()
9360 nsPop(ctxt, nsNr); in xmlParseEndTag2()
9379 xmlParseCDSect(xmlParserCtxtPtr ctxt) { in xmlParseCDSect() argument
9394 ctxt->instate = XML_PARSER_CDATA_SECTION; in xmlParseCDSect()
9397 xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL); in xmlParseCDSect()
9398 ctxt->instate = XML_PARSER_CONTENT; in xmlParseCDSect()
9404 xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL); in xmlParseCDSect()
9405 ctxt->instate = XML_PARSER_CONTENT; in xmlParseCDSect()
9412 xmlErrMemory(ctxt, NULL); in xmlParseCDSect()
9424 xmlErrMemory(ctxt, NULL); in xmlParseCDSect()
9443 ctxt->instate = XML_PARSER_CONTENT; in xmlParseCDSect()
9445 xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED, in xmlParseCDSect()
9455 if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { in xmlParseCDSect()
9456 if (ctxt->sax->cdataBlock != NULL) in xmlParseCDSect()
9457 ctxt->sax->cdataBlock(ctxt->userData, buf, len); in xmlParseCDSect()
9458 else if (ctxt->sax->characters != NULL) in xmlParseCDSect()
9459 ctxt->sax->characters(ctxt->userData, buf, len); in xmlParseCDSect()
9474 xmlParseContent(xmlParserCtxtPtr ctxt) { in xmlParseContent() argument
9478 (ctxt->instate != XML_PARSER_EOF)) { in xmlParseContent()
9480 unsigned int cons = ctxt->input->consumed; in xmlParseContent()
9481 const xmlChar *cur = ctxt->input->cur; in xmlParseContent()
9487 xmlParsePI(ctxt); in xmlParseContent()
9495 xmlParseCDSect(ctxt); in xmlParseContent()
9503 xmlParseComment(ctxt); in xmlParseContent()
9504 ctxt->instate = XML_PARSER_CONTENT; in xmlParseContent()
9511 xmlParseElement(ctxt); in xmlParseContent()
9520 xmlParseReference(ctxt); in xmlParseContent()
9527 xmlParseCharData(ctxt, 0); in xmlParseContent()
9534 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseContent()
9535 xmlPopInput(ctxt); in xmlParseContent()
9538 if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) { in xmlParseContent()
9539 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseContent()
9541 ctxt->instate = XML_PARSER_EOF; in xmlParseContent()
9562 xmlParseElement(xmlParserCtxtPtr ctxt) { in xmlParseElement() argument
9569 int nsNr = ctxt->nsNr; in xmlParseElement()
9571 if (((unsigned int) ctxt->nameNr > xmlParserMaxDepth) && in xmlParseElement()
9572 ((ctxt->options & XML_PARSE_HUGE) == 0)) { in xmlParseElement()
9573 xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseElement()
9576 ctxt->instate = XML_PARSER_EOF; in xmlParseElement()
9581 if (ctxt->record_info) { in xmlParseElement()
9582 node_info.begin_pos = ctxt->input->consumed + in xmlParseElement()
9583 (CUR_PTR - ctxt->input->base); in xmlParseElement()
9584 node_info.begin_line = ctxt->input->line; in xmlParseElement()
9587 if (ctxt->spaceNr == 0) in xmlParseElement()
9588 spacePush(ctxt, -1); in xmlParseElement()
9589 else if (*ctxt->space == -2) in xmlParseElement()
9590 spacePush(ctxt, -1); in xmlParseElement()
9592 spacePush(ctxt, *ctxt->space); in xmlParseElement()
9594 line = ctxt->input->line; in xmlParseElement()
9596 if (ctxt->sax2) in xmlParseElement()
9598 name = xmlParseStartTag2(ctxt, &prefix, &URI, &tlen); in xmlParseElement()
9601 name = xmlParseStartTag(ctxt); in xmlParseElement()
9603 if (ctxt->instate == XML_PARSER_EOF) in xmlParseElement()
9606 spacePop(ctxt); in xmlParseElement()
9609 namePush(ctxt, name); in xmlParseElement()
9610 ret = ctxt->node; in xmlParseElement()
9618 if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc && in xmlParseElement()
9619 ctxt->node && (ctxt->node == ctxt->myDoc->children)) in xmlParseElement()
9620 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); in xmlParseElement()
9628 if (ctxt->sax2) { in xmlParseElement()
9629 if ((ctxt->sax != NULL) && (ctxt->sax->endElementNs != NULL) && in xmlParseElement()
9630 (!ctxt->disableSAX)) in xmlParseElement()
9631 ctxt->sax->endElementNs(ctxt->userData, name, prefix, URI); in xmlParseElement()
9634 if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL) && in xmlParseElement()
9635 (!ctxt->disableSAX)) in xmlParseElement()
9636 ctxt->sax->endElement(ctxt->userData, name); in xmlParseElement()
9639 namePop(ctxt); in xmlParseElement()
9640 spacePop(ctxt); in xmlParseElement()
9641 if (nsNr != ctxt->nsNr) in xmlParseElement()
9642 nsPop(ctxt, ctxt->nsNr - nsNr); in xmlParseElement()
9643 if ( ret != NULL && ctxt->record_info ) { in xmlParseElement()
9644 node_info.end_pos = ctxt->input->consumed + in xmlParseElement()
9645 (CUR_PTR - ctxt->input->base); in xmlParseElement()
9646 node_info.end_line = ctxt->input->line; in xmlParseElement()
9648 xmlParserAddNodeInfo(ctxt, &node_info); in xmlParseElement()
9655 xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_GT_REQUIRED, in xmlParseElement()
9662 nodePop(ctxt); in xmlParseElement()
9663 namePop(ctxt); in xmlParseElement()
9664 spacePop(ctxt); in xmlParseElement()
9665 if (nsNr != ctxt->nsNr) in xmlParseElement()
9666 nsPop(ctxt, ctxt->nsNr - nsNr); in xmlParseElement()
9671 if ( ret != NULL && ctxt->record_info ) { in xmlParseElement()
9672 node_info.end_pos = ctxt->input->consumed + in xmlParseElement()
9673 (CUR_PTR - ctxt->input->base); in xmlParseElement()
9674 node_info.end_line = ctxt->input->line; in xmlParseElement()
9676 xmlParserAddNodeInfo(ctxt, &node_info); in xmlParseElement()
9684 xmlParseContent(ctxt); in xmlParseElement()
9686 xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NOT_FINISHED, in xmlParseElement()
9693 nodePop(ctxt); in xmlParseElement()
9694 namePop(ctxt); in xmlParseElement()
9695 spacePop(ctxt); in xmlParseElement()
9696 if (nsNr != ctxt->nsNr) in xmlParseElement()
9697 nsPop(ctxt, ctxt->nsNr - nsNr); in xmlParseElement()
9704 if (ctxt->sax2) { in xmlParseElement()
9705 xmlParseEndTag2(ctxt, prefix, URI, line, ctxt->nsNr - nsNr, tlen); in xmlParseElement()
9706 namePop(ctxt); in xmlParseElement()
9710 xmlParseEndTag1(ctxt, line); in xmlParseElement()
9716 if ( ret != NULL && ctxt->record_info ) { in xmlParseElement()
9717 node_info.end_pos = ctxt->input->consumed + in xmlParseElement()
9718 (CUR_PTR - ctxt->input->base); in xmlParseElement()
9719 node_info.end_line = ctxt->input->line; in xmlParseElement()
9721 xmlParserAddNodeInfo(ctxt, &node_info); in xmlParseElement()
9738 xmlParseVersionNum(xmlParserCtxtPtr ctxt) { in xmlParseVersionNum() argument
9746 xmlErrMemory(ctxt, NULL); in xmlParseVersionNum()
9772 xmlErrMemory(ctxt, NULL); in xmlParseVersionNum()
9799 xmlParseVersionInfo(xmlParserCtxtPtr ctxt) { in xmlParseVersionInfo() argument
9806 xmlFatalErr(ctxt, XML_ERR_EQUAL_REQUIRED, NULL); in xmlParseVersionInfo()
9813 version = xmlParseVersionNum(ctxt); in xmlParseVersionInfo()
9815 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); in xmlParseVersionInfo()
9820 version = xmlParseVersionNum(ctxt); in xmlParseVersionInfo()
9822 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); in xmlParseVersionInfo()
9826 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_STARTED, NULL); in xmlParseVersionInfo()
9843 xmlParseEncName(xmlParserCtxtPtr ctxt) { in xmlParseEncName() argument
9854 xmlErrMemory(ctxt, NULL); in xmlParseEncName()
9872 xmlErrMemory(ctxt, NULL); in xmlParseEncName()
9889 xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL); in xmlParseEncName()
9908 xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) { in xmlParseEncodingDecl() argument
9916 xmlFatalErr(ctxt, XML_ERR_EQUAL_REQUIRED, NULL); in xmlParseEncodingDecl()
9923 encoding = xmlParseEncName(ctxt); in xmlParseEncodingDecl()
9925 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); in xmlParseEncodingDecl()
9930 encoding = xmlParseEncName(ctxt); in xmlParseEncodingDecl()
9932 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); in xmlParseEncodingDecl()
9936 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_STARTED, NULL); in xmlParseEncodingDecl()
9942 if (ctxt->options & XML_PARSE_IGNORE_ENC) in xmlParseEncodingDecl()
9958 if ((ctxt->encoding == NULL) && in xmlParseEncodingDecl()
9959 (ctxt->input->buf != NULL) && in xmlParseEncodingDecl()
9960 (ctxt->input->buf->encoder == NULL)) { in xmlParseEncodingDecl()
9961 xmlFatalErrMsg(ctxt, XML_ERR_INVALID_ENCODING, in xmlParseEncodingDecl()
9964 if (ctxt->encoding != NULL) in xmlParseEncodingDecl()
9965 xmlFree((xmlChar *) ctxt->encoding); in xmlParseEncodingDecl()
9966 ctxt->encoding = encoding; in xmlParseEncodingDecl()
9974 if (ctxt->encoding != NULL) in xmlParseEncodingDecl()
9975 xmlFree((xmlChar *) ctxt->encoding); in xmlParseEncodingDecl()
9976 ctxt->encoding = encoding; in xmlParseEncodingDecl()
9981 if (ctxt->input->encoding != NULL) in xmlParseEncodingDecl()
9982 xmlFree((xmlChar *) ctxt->input->encoding); in xmlParseEncodingDecl()
9983 ctxt->input->encoding = encoding; in xmlParseEncodingDecl()
9987 xmlSwitchToEncoding(ctxt, handler); in xmlParseEncodingDecl()
9989 xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlParseEncodingDecl()
10030 xmlParseSDDecl(xmlParserCtxtPtr ctxt) { in xmlParseSDDecl() argument
10038 xmlFatalErr(ctxt, XML_ERR_EQUAL_REQUIRED, NULL); in xmlParseSDDecl()
10053 xmlFatalErr(ctxt, XML_ERR_STANDALONE_VALUE, NULL); in xmlParseSDDecl()
10056 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); in xmlParseSDDecl()
10069 xmlFatalErr(ctxt, XML_ERR_STANDALONE_VALUE, NULL); in xmlParseSDDecl()
10072 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); in xmlParseSDDecl()
10076 xmlFatalErr(ctxt, XML_ERR_STRING_NOT_STARTED, NULL); in xmlParseSDDecl()
10092 xmlParseXMLDecl(xmlParserCtxtPtr ctxt) { in xmlParseXMLDecl() argument
10100 ctxt->input->standalone = -2; in xmlParseXMLDecl()
10108 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, in xmlParseXMLDecl()
10116 version = xmlParseVersionInfo(ctxt); in xmlParseXMLDecl()
10118 xmlFatalErr(ctxt, XML_ERR_VERSION_MISSING, NULL); in xmlParseXMLDecl()
10124 if (ctxt->options & XML_PARSE_OLD10) { in xmlParseXMLDecl()
10125 xmlFatalErrMsgStr(ctxt, XML_ERR_UNKNOWN_VERSION, in xmlParseXMLDecl()
10130 xmlWarningMsg(ctxt, XML_WAR_UNKNOWN_VERSION, in xmlParseXMLDecl()
10134 xmlFatalErrMsgStr(ctxt, XML_ERR_UNKNOWN_VERSION, in xmlParseXMLDecl()
10140 if (ctxt->version != NULL) in xmlParseXMLDecl()
10141 xmlFree((void *) ctxt->version); in xmlParseXMLDecl()
10142 ctxt->version = version; in xmlParseXMLDecl()
10153 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Blank needed here\n"); in xmlParseXMLDecl()
10155 xmlParseEncodingDecl(ctxt); in xmlParseXMLDecl()
10156 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { in xmlParseXMLDecl()
10166 if ((ctxt->input->encoding != NULL) && (!IS_BLANK_CH(RAW))) { in xmlParseXMLDecl()
10171 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Blank needed here\n"); in xmlParseXMLDecl()
10180 ctxt->input->standalone = xmlParseSDDecl(ctxt); in xmlParseXMLDecl()
10187 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL); in xmlParseXMLDecl()
10190 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL); in xmlParseXMLDecl()
10206 xmlParseMisc(xmlParserCtxtPtr ctxt) { in xmlParseMisc() argument
10211 xmlParsePI(ctxt); in xmlParseMisc()
10215 xmlParseComment(ctxt); in xmlParseMisc()
10235 xmlParseDocument(xmlParserCtxtPtr ctxt) { in xmlParseDocument() argument
10241 if ((ctxt == NULL) || (ctxt->input == NULL)) in xmlParseDocument()
10249 xmlDetectSAX2(ctxt); in xmlParseDocument()
10254 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) in xmlParseDocument()
10255 ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); in xmlParseDocument()
10257 if ((ctxt->encoding == NULL) && in xmlParseDocument()
10258 ((ctxt->input->end - ctxt->input->cur) >= 4)) { in xmlParseDocument()
10270 xmlSwitchEncoding(ctxt, enc); in xmlParseDocument()
10276 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL); in xmlParseDocument()
10285 if ((ctxt->input->end - ctxt->input->cur) < 35) { in xmlParseDocument()
10293 xmlParseXMLDecl(ctxt); in xmlParseDocument()
10294 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { in xmlParseDocument()
10300 ctxt->standalone = ctxt->input->standalone; in xmlParseDocument()
10303 ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION); in xmlParseDocument()
10305 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX)) in xmlParseDocument()
10306 ctxt->sax->startDocument(ctxt->userData); in xmlParseDocument()
10312 xmlParseMisc(ctxt); in xmlParseDocument()
10321 ctxt->inSubset = 1; in xmlParseDocument()
10322 xmlParseDocTypeDecl(ctxt); in xmlParseDocument()
10324 ctxt->instate = XML_PARSER_DTD; in xmlParseDocument()
10325 xmlParseInternalSubset(ctxt); in xmlParseDocument()
10331 ctxt->inSubset = 2; in xmlParseDocument()
10332 if ((ctxt->sax != NULL) && (ctxt->sax->externalSubset != NULL) && in xmlParseDocument()
10333 (!ctxt->disableSAX)) in xmlParseDocument()
10334 ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName, in xmlParseDocument()
10335 ctxt->extSubSystem, ctxt->extSubURI); in xmlParseDocument()
10336 ctxt->inSubset = 0; in xmlParseDocument()
10338 xmlCleanSpecialAttr(ctxt); in xmlParseDocument()
10340 ctxt->instate = XML_PARSER_PROLOG; in xmlParseDocument()
10341 xmlParseMisc(ctxt); in xmlParseDocument()
10349 xmlFatalErrMsg(ctxt, XML_ERR_DOCUMENT_EMPTY, in xmlParseDocument()
10352 ctxt->instate = XML_PARSER_CONTENT; in xmlParseDocument()
10353 xmlParseElement(ctxt); in xmlParseDocument()
10354 ctxt->instate = XML_PARSER_EPILOG; in xmlParseDocument()
10360 xmlParseMisc(ctxt); in xmlParseDocument()
10363 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); in xmlParseDocument()
10365 ctxt->instate = XML_PARSER_EOF; in xmlParseDocument()
10371 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in xmlParseDocument()
10372 ctxt->sax->endDocument(ctxt->userData); in xmlParseDocument()
10377 if ((ctxt->myDoc != NULL) && in xmlParseDocument()
10378 (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) { in xmlParseDocument()
10379 xmlFreeDoc(ctxt->myDoc); in xmlParseDocument()
10380 ctxt->myDoc = NULL; in xmlParseDocument()
10383 if ((ctxt->wellFormed) && (ctxt->myDoc != NULL)) { in xmlParseDocument()
10384 ctxt->myDoc->properties |= XML_DOC_WELLFORMED; in xmlParseDocument()
10385 if (ctxt->valid) in xmlParseDocument()
10386 ctxt->myDoc->properties |= XML_DOC_DTDVALID; in xmlParseDocument()
10387 if (ctxt->nsWellFormed) in xmlParseDocument()
10388 ctxt->myDoc->properties |= XML_DOC_NSVALID; in xmlParseDocument()
10389 if (ctxt->options & XML_PARSE_OLD10) in xmlParseDocument()
10390 ctxt->myDoc->properties |= XML_DOC_OLD10; in xmlParseDocument()
10392 if (! ctxt->wellFormed) { in xmlParseDocument()
10393 ctxt->valid = 0; in xmlParseDocument()
10414 xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) { in xmlParseExtParsedEnt() argument
10418 if ((ctxt == NULL) || (ctxt->input == NULL)) in xmlParseExtParsedEnt()
10423 xmlDetectSAX2(ctxt); in xmlParseExtParsedEnt()
10430 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) in xmlParseExtParsedEnt()
10431 ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); in xmlParseExtParsedEnt()
10438 if ((ctxt->input->end - ctxt->input->cur) >= 4) { in xmlParseExtParsedEnt()
10445 xmlSwitchEncoding(ctxt, enc); in xmlParseExtParsedEnt()
10451 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL); in xmlParseExtParsedEnt()
10463 xmlParseXMLDecl(ctxt); in xmlParseExtParsedEnt()
10464 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { in xmlParseExtParsedEnt()
10472 ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION); in xmlParseExtParsedEnt()
10474 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX)) in xmlParseExtParsedEnt()
10475 ctxt->sax->startDocument(ctxt->userData); in xmlParseExtParsedEnt()
10480 ctxt->instate = XML_PARSER_CONTENT; in xmlParseExtParsedEnt()
10481 ctxt->validate = 0; in xmlParseExtParsedEnt()
10482 ctxt->loadsubset = 0; in xmlParseExtParsedEnt()
10483 ctxt->depth = 0; in xmlParseExtParsedEnt()
10485 xmlParseContent(ctxt); in xmlParseExtParsedEnt()
10488 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseExtParsedEnt()
10490 xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); in xmlParseExtParsedEnt()
10496 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in xmlParseExtParsedEnt()
10497 ctxt->sax->endDocument(ctxt->userData); in xmlParseExtParsedEnt()
10499 if (! ctxt->wellFormed) return(-1); in xmlParseExtParsedEnt()
10527 xmlParseLookupSequence(xmlParserCtxtPtr ctxt, xmlChar first, in xmlParseLookupSequence() argument
10533 in = ctxt->input; in xmlParseLookupSequence()
10537 if (ctxt->checkIndex > base) in xmlParseLookupSequence()
10538 base = ctxt->checkIndex; in xmlParseLookupSequence()
10557 ctxt->checkIndex = 0; in xmlParseLookupSequence()
10575 ctxt->checkIndex = base; in xmlParseLookupSequence()
10599 xmlParseGetLasts(xmlParserCtxtPtr ctxt, const xmlChar **lastlt, in xmlParseGetLasts() argument
10603 if ((ctxt == NULL) || (lastlt == NULL) || (lastgt == NULL)) { in xmlParseGetLasts()
10608 if ((ctxt->progressive != 0) && (ctxt->inputNr == 1)) { in xmlParseGetLasts()
10609 tmp = ctxt->input->end; in xmlParseGetLasts()
10611 while ((tmp >= ctxt->input->base) && (*tmp != '<')) tmp--; in xmlParseGetLasts()
10612 if (tmp < ctxt->input->base) { in xmlParseGetLasts()
10618 while ((tmp < ctxt->input->end) && (*tmp != '>')) { in xmlParseGetLasts()
10621 while ((tmp < ctxt->input->end) && (*tmp != '\'')) tmp++; in xmlParseGetLasts()
10622 if (tmp < ctxt->input->end) tmp++; in xmlParseGetLasts()
10625 while ((tmp < ctxt->input->end) && (*tmp != '"')) tmp++; in xmlParseGetLasts()
10626 if (tmp < ctxt->input->end) tmp++; in xmlParseGetLasts()
10630 if (tmp < ctxt->input->end) in xmlParseGetLasts()
10635 while ((tmp >= ctxt->input->base) && (*tmp != '>')) tmp--; in xmlParseGetLasts()
10636 if (tmp >= ctxt->input->base) in xmlParseGetLasts()
10724 xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { in xmlParseTryOrFinish() argument
10730 if (ctxt->input == NULL) in xmlParseTryOrFinish()
10734 switch (ctxt->instate) { in xmlParseTryOrFinish()
10786 if ((ctxt->input != NULL) && in xmlParseTryOrFinish()
10787 (ctxt->input->cur - ctxt->input->base > 4096)) { in xmlParseTryOrFinish()
10788 xmlSHRINK(ctxt); in xmlParseTryOrFinish()
10789 ctxt->checkIndex = 0; in xmlParseTryOrFinish()
10791 xmlParseGetLasts(ctxt, &lastlt, &lastgt); in xmlParseTryOrFinish()
10794 if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1)) in xmlParseTryOrFinish()
10801 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseTryOrFinish()
10802 xmlPopInput(ctxt); in xmlParseTryOrFinish()
10804 if (ctxt->input == NULL) break; in xmlParseTryOrFinish()
10805 if (ctxt->input->buf == NULL) in xmlParseTryOrFinish()
10806 avail = ctxt->input->length - in xmlParseTryOrFinish()
10807 (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
10814 if ((ctxt->input->buf->raw != NULL) && in xmlParseTryOrFinish()
10815 (ctxt->input->buf->raw->use > 0)) { in xmlParseTryOrFinish()
10816 int base = ctxt->input->base - in xmlParseTryOrFinish()
10817 ctxt->input->buf->buffer->content; in xmlParseTryOrFinish()
10818 int current = ctxt->input->cur - ctxt->input->base; in xmlParseTryOrFinish()
10820 xmlParserInputBufferPush(ctxt->input->buf, 0, ""); in xmlParseTryOrFinish()
10821 ctxt->input->base = ctxt->input->buf->buffer->content + base; in xmlParseTryOrFinish()
10822 ctxt->input->cur = ctxt->input->base + current; in xmlParseTryOrFinish()
10823 ctxt->input->end = in xmlParseTryOrFinish()
10824 &ctxt->input->buf->buffer->content[ in xmlParseTryOrFinish()
10825 ctxt->input->buf->buffer->use]; in xmlParseTryOrFinish()
10827 avail = ctxt->input->buf->buffer->use - in xmlParseTryOrFinish()
10828 (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
10832 switch (ctxt->instate) { in xmlParseTryOrFinish()
10839 if (ctxt->charset == XML_CHAR_ENCODING_NONE) { in xmlParseTryOrFinish()
10861 xmlSwitchEncoding(ctxt, enc); in xmlParseTryOrFinish()
10867 cur = ctxt->input->cur[0]; in xmlParseTryOrFinish()
10868 next = ctxt->input->cur[1]; in xmlParseTryOrFinish()
10870 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) in xmlParseTryOrFinish()
10871 ctxt->sax->setDocumentLocator(ctxt->userData, in xmlParseTryOrFinish()
10873 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL); in xmlParseTryOrFinish()
10874 ctxt->instate = XML_PARSER_EOF; in xmlParseTryOrFinish()
10879 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in xmlParseTryOrFinish()
10880 ctxt->sax->endDocument(ctxt->userData); in xmlParseTryOrFinish()
10887 (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) in xmlParseTryOrFinish()
10889 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) in xmlParseTryOrFinish()
10890 ctxt->sax->setDocumentLocator(ctxt->userData, in xmlParseTryOrFinish()
10892 if ((ctxt->input->cur[2] == 'x') && in xmlParseTryOrFinish()
10893 (ctxt->input->cur[3] == 'm') && in xmlParseTryOrFinish()
10894 (ctxt->input->cur[4] == 'l') && in xmlParseTryOrFinish()
10895 (IS_BLANK_CH(ctxt->input->cur[5]))) { in xmlParseTryOrFinish()
10901 xmlParseXMLDecl(ctxt); in xmlParseTryOrFinish()
10902 if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { in xmlParseTryOrFinish()
10907 ctxt->instate = XML_PARSER_EOF; in xmlParseTryOrFinish()
10910 ctxt->standalone = ctxt->input->standalone; in xmlParseTryOrFinish()
10911 if ((ctxt->encoding == NULL) && in xmlParseTryOrFinish()
10912 (ctxt->input->encoding != NULL)) in xmlParseTryOrFinish()
10913 ctxt->encoding = xmlStrdup(ctxt->input->encoding); in xmlParseTryOrFinish()
10914 if ((ctxt->sax) && (ctxt->sax->startDocument) && in xmlParseTryOrFinish()
10915 (!ctxt->disableSAX)) in xmlParseTryOrFinish()
10916 ctxt->sax->startDocument(ctxt->userData); in xmlParseTryOrFinish()
10917 ctxt->instate = XML_PARSER_MISC; in xmlParseTryOrFinish()
10923 ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION); in xmlParseTryOrFinish()
10924 if ((ctxt->sax) && (ctxt->sax->startDocument) && in xmlParseTryOrFinish()
10925 (!ctxt->disableSAX)) in xmlParseTryOrFinish()
10926 ctxt->sax->startDocument(ctxt->userData); in xmlParseTryOrFinish()
10927 ctxt->instate = XML_PARSER_MISC; in xmlParseTryOrFinish()
10934 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) in xmlParseTryOrFinish()
10935 ctxt->sax->setDocumentLocator(ctxt->userData, in xmlParseTryOrFinish()
10937 ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION); in xmlParseTryOrFinish()
10938 if (ctxt->version == NULL) { in xmlParseTryOrFinish()
10939 xmlErrMemory(ctxt, NULL); in xmlParseTryOrFinish()
10942 if ((ctxt->sax) && (ctxt->sax->startDocument) && in xmlParseTryOrFinish()
10943 (!ctxt->disableSAX)) in xmlParseTryOrFinish()
10944 ctxt->sax->startDocument(ctxt->userData); in xmlParseTryOrFinish()
10945 ctxt->instate = XML_PARSER_MISC; in xmlParseTryOrFinish()
10956 int nsNr = ctxt->nsNr; in xmlParseTryOrFinish()
10958 if ((avail < 2) && (ctxt->inputNr == 1)) in xmlParseTryOrFinish()
10960 cur = ctxt->input->cur[0]; in xmlParseTryOrFinish()
10962 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL); in xmlParseTryOrFinish()
10963 ctxt->instate = XML_PARSER_EOF; in xmlParseTryOrFinish()
10964 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in xmlParseTryOrFinish()
10965 ctxt->sax->endDocument(ctxt->userData); in xmlParseTryOrFinish()
10969 if (ctxt->progressive) { in xmlParseTryOrFinish()
10971 if ((lastgt == NULL) || (ctxt->input->cur >= lastgt)) in xmlParseTryOrFinish()
10973 } else if (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0) { in xmlParseTryOrFinish()
10977 if (ctxt->spaceNr == 0) in xmlParseTryOrFinish()
10978 spacePush(ctxt, -1); in xmlParseTryOrFinish()
10979 else if (*ctxt->space == -2) in xmlParseTryOrFinish()
10980 spacePush(ctxt, -1); in xmlParseTryOrFinish()
10982 spacePush(ctxt, *ctxt->space); in xmlParseTryOrFinish()
10984 if (ctxt->sax2) in xmlParseTryOrFinish()
10986 name = xmlParseStartTag2(ctxt, &prefix, &URI, &tlen); in xmlParseTryOrFinish()
10989 name = xmlParseStartTag(ctxt); in xmlParseTryOrFinish()
10991 if (ctxt->instate == XML_PARSER_EOF) in xmlParseTryOrFinish()
10994 spacePop(ctxt); in xmlParseTryOrFinish()
10995 ctxt->instate = XML_PARSER_EOF; in xmlParseTryOrFinish()
10996 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in xmlParseTryOrFinish()
10997 ctxt->sax->endDocument(ctxt->userData); in xmlParseTryOrFinish()
11006 if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc && in xmlParseTryOrFinish()
11007 ctxt->node && (ctxt->node == ctxt->myDoc->children)) in xmlParseTryOrFinish()
11008 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); in xmlParseTryOrFinish()
11017 if (ctxt->sax2) { in xmlParseTryOrFinish()
11018 if ((ctxt->sax != NULL) && in xmlParseTryOrFinish()
11019 (ctxt->sax->endElementNs != NULL) && in xmlParseTryOrFinish()
11020 (!ctxt->disableSAX)) in xmlParseTryOrFinish()
11021 ctxt->sax->endElementNs(ctxt->userData, name, in xmlParseTryOrFinish()
11023 if (ctxt->nsNr - nsNr > 0) in xmlParseTryOrFinish()
11024 nsPop(ctxt, ctxt->nsNr - nsNr); in xmlParseTryOrFinish()
11027 if ((ctxt->sax != NULL) && in xmlParseTryOrFinish()
11028 (ctxt->sax->endElement != NULL) && in xmlParseTryOrFinish()
11029 (!ctxt->disableSAX)) in xmlParseTryOrFinish()
11030 ctxt->sax->endElement(ctxt->userData, name); in xmlParseTryOrFinish()
11033 spacePop(ctxt); in xmlParseTryOrFinish()
11034 if (ctxt->nameNr == 0) { in xmlParseTryOrFinish()
11035 ctxt->instate = XML_PARSER_EPILOG; in xmlParseTryOrFinish()
11037 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11044 xmlFatalErrMsgStr(ctxt, XML_ERR_GT_REQUIRED, in xmlParseTryOrFinish()
11047 nodePop(ctxt); in xmlParseTryOrFinish()
11048 spacePop(ctxt); in xmlParseTryOrFinish()
11050 if (ctxt->sax2) in xmlParseTryOrFinish()
11051 nameNsPush(ctxt, name, prefix, URI, ctxt->nsNr - nsNr); in xmlParseTryOrFinish()
11054 namePush(ctxt, name); in xmlParseTryOrFinish()
11057 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11063 if ((avail < 2) && (ctxt->inputNr == 1)) in xmlParseTryOrFinish()
11065 cur = ctxt->input->cur[0]; in xmlParseTryOrFinish()
11066 next = ctxt->input->cur[1]; in xmlParseTryOrFinish()
11069 cons = ctxt->input->consumed; in xmlParseTryOrFinish()
11071 ctxt->instate = XML_PARSER_END_TAG; in xmlParseTryOrFinish()
11075 (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) in xmlParseTryOrFinish()
11077 xmlParsePI(ctxt); in xmlParseTryOrFinish()
11079 ctxt->instate = XML_PARSER_START_TAG; in xmlParseTryOrFinish()
11082 (ctxt->input->cur[2] == '-') && in xmlParseTryOrFinish()
11083 (ctxt->input->cur[3] == '-')) { in xmlParseTryOrFinish()
11088 ctxt->input->cur += 4; in xmlParseTryOrFinish()
11089 term = xmlParseLookupSequence(ctxt, '-', '-', '>'); in xmlParseTryOrFinish()
11090 ctxt->input->cur -= 4; in xmlParseTryOrFinish()
11093 xmlParseComment(ctxt); in xmlParseTryOrFinish()
11094 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11095 } else if ((cur == '<') && (ctxt->input->cur[1] == '!') && in xmlParseTryOrFinish()
11096 (ctxt->input->cur[2] == '[') && in xmlParseTryOrFinish()
11097 (ctxt->input->cur[3] == 'C') && in xmlParseTryOrFinish()
11098 (ctxt->input->cur[4] == 'D') && in xmlParseTryOrFinish()
11099 (ctxt->input->cur[5] == 'A') && in xmlParseTryOrFinish()
11100 (ctxt->input->cur[6] == 'T') && in xmlParseTryOrFinish()
11101 (ctxt->input->cur[7] == 'A') && in xmlParseTryOrFinish()
11102 (ctxt->input->cur[8] == '[')) { in xmlParseTryOrFinish()
11104 ctxt->instate = XML_PARSER_CDATA_SECTION; in xmlParseTryOrFinish()
11111 (xmlParseLookupSequence(ctxt, ';', 0, 0) < 0)) in xmlParseTryOrFinish()
11113 xmlParseReference(ctxt); in xmlParseTryOrFinish()
11127 if ((ctxt->inputNr == 1) && in xmlParseTryOrFinish()
11130 if (ctxt->progressive) { in xmlParseTryOrFinish()
11132 (ctxt->input->cur > lastlt)) in xmlParseTryOrFinish()
11134 } else if (xmlParseLookupSequence(ctxt, in xmlParseTryOrFinish()
11140 ctxt->checkIndex = 0; in xmlParseTryOrFinish()
11141 xmlParseCharData(ctxt, 0); in xmlParseTryOrFinish()
11146 while ((RAW == 0) && (ctxt->inputNr > 1)) in xmlParseTryOrFinish()
11147 xmlPopInput(ctxt); in xmlParseTryOrFinish()
11148 if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) { in xmlParseTryOrFinish()
11149 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, in xmlParseTryOrFinish()
11151 ctxt->instate = XML_PARSER_EOF; in xmlParseTryOrFinish()
11160 if (ctxt->progressive) { in xmlParseTryOrFinish()
11162 if ((lastgt == NULL) || (ctxt->input->cur >= lastgt)) in xmlParseTryOrFinish()
11164 } else if (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0) { in xmlParseTryOrFinish()
11168 if (ctxt->sax2) { in xmlParseTryOrFinish()
11169 xmlParseEndTag2(ctxt, in xmlParseTryOrFinish()
11170 (void *) ctxt->pushTab[ctxt->nameNr * 3 - 3], in xmlParseTryOrFinish()
11171 (void *) ctxt->pushTab[ctxt->nameNr * 3 - 2], 0, in xmlParseTryOrFinish()
11172 (int) (long) ctxt->pushTab[ctxt->nameNr * 3 - 1], 0); in xmlParseTryOrFinish()
11173 nameNsPop(ctxt); in xmlParseTryOrFinish()
11177 xmlParseEndTag1(ctxt, 0); in xmlParseTryOrFinish()
11179 if (ctxt->instate == XML_PARSER_EOF) { in xmlParseTryOrFinish()
11181 } else if (ctxt->nameNr == 0) { in xmlParseTryOrFinish()
11182 ctxt->instate = XML_PARSER_EPILOG; in xmlParseTryOrFinish()
11184 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11194 base = xmlParseLookupSequence(ctxt, ']', ']', '>'); in xmlParseTryOrFinish()
11199 tmp = xmlCheckCdataPush(ctxt->input->cur, in xmlParseTryOrFinish()
11203 ctxt->input->cur += tmp; in xmlParseTryOrFinish()
11206 if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { in xmlParseTryOrFinish()
11207 if (ctxt->sax->cdataBlock != NULL) in xmlParseTryOrFinish()
11208 ctxt->sax->cdataBlock(ctxt->userData, in xmlParseTryOrFinish()
11209 ctxt->input->cur, tmp); in xmlParseTryOrFinish()
11210 else if (ctxt->sax->characters != NULL) in xmlParseTryOrFinish()
11211 ctxt->sax->characters(ctxt->userData, in xmlParseTryOrFinish()
11212 ctxt->input->cur, tmp); in xmlParseTryOrFinish()
11215 ctxt->checkIndex = 0; in xmlParseTryOrFinish()
11221 tmp = xmlCheckCdataPush(ctxt->input->cur, base); in xmlParseTryOrFinish()
11224 ctxt->input->cur += tmp; in xmlParseTryOrFinish()
11227 if ((ctxt->sax != NULL) && (base == 0) && in xmlParseTryOrFinish()
11228 (ctxt->sax->cdataBlock != NULL) && in xmlParseTryOrFinish()
11229 (!ctxt->disableSAX)) { in xmlParseTryOrFinish()
11235 if ((ctxt->input->cur - ctxt->input->base >= 9) && in xmlParseTryOrFinish()
11236 (!strncmp((const char *)&ctxt->input->cur[-9], in xmlParseTryOrFinish()
11238 ctxt->sax->cdataBlock(ctxt->userData, in xmlParseTryOrFinish()
11240 } else if ((ctxt->sax != NULL) && (base > 0) && in xmlParseTryOrFinish()
11241 (!ctxt->disableSAX)) { in xmlParseTryOrFinish()
11242 if (ctxt->sax->cdataBlock != NULL) in xmlParseTryOrFinish()
11243 ctxt->sax->cdataBlock(ctxt->userData, in xmlParseTryOrFinish()
11244 ctxt->input->cur, base); in xmlParseTryOrFinish()
11245 else if (ctxt->sax->characters != NULL) in xmlParseTryOrFinish()
11246 ctxt->sax->characters(ctxt->userData, in xmlParseTryOrFinish()
11247 ctxt->input->cur, base); in xmlParseTryOrFinish()
11250 ctxt->checkIndex = 0; in xmlParseTryOrFinish()
11251 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11261 if (ctxt->input->buf == NULL) in xmlParseTryOrFinish()
11262 avail = ctxt->input->length - in xmlParseTryOrFinish()
11263 (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
11265 avail = ctxt->input->buf->buffer->use - in xmlParseTryOrFinish()
11266 (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
11269 cur = ctxt->input->cur[0]; in xmlParseTryOrFinish()
11270 next = ctxt->input->cur[1]; in xmlParseTryOrFinish()
11273 (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) in xmlParseTryOrFinish()
11279 xmlParsePI(ctxt); in xmlParseTryOrFinish()
11280 ctxt->checkIndex = 0; in xmlParseTryOrFinish()
11282 (ctxt->input->cur[2] == '-') && in xmlParseTryOrFinish()
11283 (ctxt->input->cur[3] == '-')) { in xmlParseTryOrFinish()
11285 (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) in xmlParseTryOrFinish()
11291 xmlParseComment(ctxt); in xmlParseTryOrFinish()
11292 ctxt->instate = XML_PARSER_MISC; in xmlParseTryOrFinish()
11293 ctxt->checkIndex = 0; in xmlParseTryOrFinish()
11295 (ctxt->input->cur[2] == 'D') && in xmlParseTryOrFinish()
11296 (ctxt->input->cur[3] == 'O') && in xmlParseTryOrFinish()
11297 (ctxt->input->cur[4] == 'C') && in xmlParseTryOrFinish()
11298 (ctxt->input->cur[5] == 'T') && in xmlParseTryOrFinish()
11299 (ctxt->input->cur[6] == 'Y') && in xmlParseTryOrFinish()
11300 (ctxt->input->cur[7] == 'P') && in xmlParseTryOrFinish()
11301 (ctxt->input->cur[8] == 'E')) { in xmlParseTryOrFinish()
11303 (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) in xmlParseTryOrFinish()
11309 ctxt->inSubset = 1; in xmlParseTryOrFinish()
11310 xmlParseDocTypeDecl(ctxt); in xmlParseTryOrFinish()
11312 ctxt->instate = XML_PARSER_DTD; in xmlParseTryOrFinish()
11321 ctxt->inSubset = 2; in xmlParseTryOrFinish()
11322 if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && in xmlParseTryOrFinish()
11323 (ctxt->sax->externalSubset != NULL)) in xmlParseTryOrFinish()
11324 ctxt->sax->externalSubset(ctxt->userData, in xmlParseTryOrFinish()
11325 ctxt->intSubName, ctxt->extSubSystem, in xmlParseTryOrFinish()
11326 ctxt->extSubURI); in xmlParseTryOrFinish()
11327 ctxt->inSubset = 0; in xmlParseTryOrFinish()
11328 xmlCleanSpecialAttr(ctxt); in xmlParseTryOrFinish()
11329 ctxt->instate = XML_PARSER_PROLOG; in xmlParseTryOrFinish()
11339 ctxt->instate = XML_PARSER_START_TAG; in xmlParseTryOrFinish()
11340 ctxt->progressive = 1; in xmlParseTryOrFinish()
11341 xmlParseGetLasts(ctxt, &lastlt, &lastgt); in xmlParseTryOrFinish()
11350 if (ctxt->input->buf == NULL) in xmlParseTryOrFinish()
11351 avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
11353 avail = ctxt->input->buf->buffer->use - (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
11356 cur = ctxt->input->cur[0]; in xmlParseTryOrFinish()
11357 next = ctxt->input->cur[1]; in xmlParseTryOrFinish()
11360 (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) in xmlParseTryOrFinish()
11366 xmlParsePI(ctxt); in xmlParseTryOrFinish()
11368 (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) { in xmlParseTryOrFinish()
11370 (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) in xmlParseTryOrFinish()
11376 xmlParseComment(ctxt); in xmlParseTryOrFinish()
11377 ctxt->instate = XML_PARSER_PROLOG; in xmlParseTryOrFinish()
11382 ctxt->instate = XML_PARSER_START_TAG; in xmlParseTryOrFinish()
11383 if (ctxt->progressive == 0) in xmlParseTryOrFinish()
11384 ctxt->progressive = 1; in xmlParseTryOrFinish()
11385 xmlParseGetLasts(ctxt, &lastlt, &lastgt); in xmlParseTryOrFinish()
11394 if (ctxt->input->buf == NULL) in xmlParseTryOrFinish()
11395 avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
11397 avail = ctxt->input->buf->buffer->use - (ctxt->input->cur - ctxt->input->base); in xmlParseTryOrFinish()
11400 cur = ctxt->input->cur[0]; in xmlParseTryOrFinish()
11401 next = ctxt->input->cur[1]; in xmlParseTryOrFinish()
11404 (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) in xmlParseTryOrFinish()
11410 xmlParsePI(ctxt); in xmlParseTryOrFinish()
11411 ctxt->instate = XML_PARSER_EPILOG; in xmlParseTryOrFinish()
11413 (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) { in xmlParseTryOrFinish()
11415 (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) in xmlParseTryOrFinish()
11421 xmlParseComment(ctxt); in xmlParseTryOrFinish()
11422 ctxt->instate = XML_PARSER_EPILOG; in xmlParseTryOrFinish()
11427 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); in xmlParseTryOrFinish()
11428 ctxt->instate = XML_PARSER_EOF; in xmlParseTryOrFinish()
11433 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in xmlParseTryOrFinish()
11434 ctxt->sax->endDocument(ctxt->userData); in xmlParseTryOrFinish()
11453 base = ctxt->input->cur - ctxt->input->base; in xmlParseTryOrFinish()
11455 if (ctxt->checkIndex > base) in xmlParseTryOrFinish()
11456 base = ctxt->checkIndex; in xmlParseTryOrFinish()
11457 buf = ctxt->input->buf->buffer->content; in xmlParseTryOrFinish()
11458 for (;(unsigned int) base < ctxt->input->buf->buffer->use; in xmlParseTryOrFinish()
11469 ctxt->input->buf->buffer->use) && in xmlParseTryOrFinish()
11474 ctxt->input->buf->buffer->use; base++) { in xmlParseTryOrFinish()
11506 ctxt->input->buf->buffer->use) in xmlParseTryOrFinish()
11514 (unsigned int) base + i < ctxt->input->buf->buffer->use; in xmlParseTryOrFinish()
11549 xmlParseInternalSubset(ctxt); in xmlParseTryOrFinish()
11550 ctxt->inSubset = 2; in xmlParseTryOrFinish()
11551 if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && in xmlParseTryOrFinish()
11552 (ctxt->sax->externalSubset != NULL)) in xmlParseTryOrFinish()
11553 ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName, in xmlParseTryOrFinish()
11554 ctxt->extSubSystem, ctxt->extSubURI); in xmlParseTryOrFinish()
11555 ctxt->inSubset = 0; in xmlParseTryOrFinish()
11556 xmlCleanSpecialAttr(ctxt); in xmlParseTryOrFinish()
11557 ctxt->instate = XML_PARSER_PROLOG; in xmlParseTryOrFinish()
11558 ctxt->checkIndex = 0; in xmlParseTryOrFinish()
11568 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11577 ctxt->instate = XML_PARSER_DTD; in xmlParseTryOrFinish()
11586 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11595 ctxt->instate = XML_PARSER_DTD; in xmlParseTryOrFinish()
11604 ctxt->instate = XML_PARSER_CONTENT; in xmlParseTryOrFinish()
11613 ctxt->instate = XML_PARSER_START_TAG; in xmlParseTryOrFinish()
11622 ctxt->instate = XML_PARSER_START_TAG; in xmlParseTryOrFinish()
11631 ctxt->instate = XML_PARSER_START_TAG; in xmlParseTryOrFinish()
11649 ctxt->input->cur[0], ctxt->input->cur[1], in xmlParseTryOrFinish()
11650 ctxt->input->cur[2], ctxt->input->cur[3]); in xmlParseTryOrFinish()
11651 __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, in xmlParseTryOrFinish()
11670 xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size, in xmlParseChunk() argument
11675 if (ctxt == NULL) in xmlParseChunk()
11677 if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1)) in xmlParseChunk()
11678 return(ctxt->errNo); in xmlParseChunk()
11679 if (ctxt->instate == XML_PARSER_START) in xmlParseChunk()
11680 xmlDetectSAX2(ctxt); in xmlParseChunk()
11689 if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && in xmlParseChunk()
11690 (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { in xmlParseChunk()
11691 int base = ctxt->input->base - ctxt->input->buf->buffer->content; in xmlParseChunk()
11692 int cur = ctxt->input->cur - ctxt->input->base; in xmlParseChunk()
11700 if ((ctxt->instate == XML_PARSER_START) && (ctxt->input != NULL) && in xmlParseChunk()
11701 (ctxt->input->buf != NULL) && (ctxt->input->buf->encoder != NULL)) { in xmlParseChunk()
11704 if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, in xmlParseChunk()
11706 (xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, in xmlParseChunk()
11709 else if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, in xmlParseChunk()
11711 (xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, in xmlParseChunk()
11715 if (ctxt->input->buf->rawconsumed < len) in xmlParseChunk()
11716 len -= ctxt->input->buf->rawconsumed; in xmlParseChunk()
11730 res =xmlParserInputBufferPush(ctxt->input->buf, size, chunk); in xmlParseChunk()
11732 ctxt->errNo = XML_PARSER_EOF; in xmlParseChunk()
11733 ctxt->disableSAX = 1; in xmlParseChunk()
11736 ctxt->input->base = ctxt->input->buf->buffer->content + base; in xmlParseChunk()
11737 ctxt->input->cur = ctxt->input->base + cur; in xmlParseChunk()
11738 ctxt->input->end = in xmlParseChunk()
11739 &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; in xmlParseChunk()
11744 } else if (ctxt->instate != XML_PARSER_EOF) { in xmlParseChunk()
11745 if ((ctxt->input != NULL) && ctxt->input->buf != NULL) { in xmlParseChunk()
11746 xmlParserInputBufferPtr in = ctxt->input->buf; in xmlParseChunk()
11762 xmlParseTryOrFinish(ctxt, 0); in xmlParseChunk()
11764 xmlParseTryOrFinish(ctxt, terminate); in xmlParseChunk()
11765 if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1)) in xmlParseChunk()
11766 return(ctxt->errNo); in xmlParseChunk()
11774 if ((end_in_lf == 1) && (ctxt->input != NULL) && in xmlParseChunk()
11775 (ctxt->input->buf != NULL)) { in xmlParseChunk()
11776 xmlParserInputBufferPush(ctxt->input->buf, 1, "\r"); in xmlParseChunk()
11784 if (ctxt->input != NULL) { in xmlParseChunk()
11785 if (ctxt->input->buf == NULL) in xmlParseChunk()
11786 avail = ctxt->input->length - in xmlParseChunk()
11787 (ctxt->input->cur - ctxt->input->base); in xmlParseChunk()
11789 avail = ctxt->input->buf->buffer->use - in xmlParseChunk()
11790 (ctxt->input->cur - ctxt->input->base); in xmlParseChunk()
11793 if ((ctxt->instate != XML_PARSER_EOF) && in xmlParseChunk()
11794 (ctxt->instate != XML_PARSER_EPILOG)) { in xmlParseChunk()
11795 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); in xmlParseChunk()
11797 if ((ctxt->instate == XML_PARSER_EPILOG) && (avail > 0)) { in xmlParseChunk()
11798 xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); in xmlParseChunk()
11800 if (ctxt->instate != XML_PARSER_EOF) { in xmlParseChunk()
11801 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) in xmlParseChunk()
11802 ctxt->sax->endDocument(ctxt->userData); in xmlParseChunk()
11804 ctxt->instate = XML_PARSER_EOF; in xmlParseChunk()
11806 return((xmlParserErrors) ctxt->errNo); in xmlParseChunk()
11837 xmlParserCtxtPtr ctxt; in xmlCreatePushParserCtxt() local
11851 ctxt = xmlNewParserCtxt(); in xmlCreatePushParserCtxt()
11852 if (ctxt == NULL) { in xmlCreatePushParserCtxt()
11857 ctxt->dictNames = 1; in xmlCreatePushParserCtxt()
11858 ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 * sizeof(xmlChar *)); in xmlCreatePushParserCtxt()
11859 if (ctxt->pushTab == NULL) { in xmlCreatePushParserCtxt()
11860 xmlErrMemory(ctxt, NULL); in xmlCreatePushParserCtxt()
11862 xmlFreeParserCtxt(ctxt); in xmlCreatePushParserCtxt()
11867 if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler) in xmlCreatePushParserCtxt()
11869 xmlFree(ctxt->sax); in xmlCreatePushParserCtxt()
11870 ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler)); in xmlCreatePushParserCtxt()
11871 if (ctxt->sax == NULL) { in xmlCreatePushParserCtxt()
11872 xmlErrMemory(ctxt, NULL); in xmlCreatePushParserCtxt()
11874 xmlFreeParserCtxt(ctxt); in xmlCreatePushParserCtxt()
11877 memset(ctxt->sax, 0, sizeof(xmlSAXHandler)); in xmlCreatePushParserCtxt()
11879 memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler)); in xmlCreatePushParserCtxt()
11881 memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1)); in xmlCreatePushParserCtxt()
11883 ctxt->userData = user_data; in xmlCreatePushParserCtxt()
11886 ctxt->directory = NULL; in xmlCreatePushParserCtxt()
11888 ctxt->directory = xmlParserGetDirectory(filename); in xmlCreatePushParserCtxt()
11891 inputStream = xmlNewInputStream(ctxt); in xmlCreatePushParserCtxt()
11893 xmlFreeParserCtxt(ctxt); in xmlCreatePushParserCtxt()
11904 xmlFreeParserCtxt(ctxt); in xmlCreatePushParserCtxt()
11915 inputPush(ctxt, inputStream); in xmlCreatePushParserCtxt()
11923 ctxt->charset = XML_CHAR_ENCODING_NONE; in xmlCreatePushParserCtxt()
11924 } else if ((ctxt->input != NULL) && (ctxt->input->buf != NULL)) { in xmlCreatePushParserCtxt()
11925 int base = ctxt->input->base - ctxt->input->buf->buffer->content; in xmlCreatePushParserCtxt()
11926 int cur = ctxt->input->cur - ctxt->input->base; in xmlCreatePushParserCtxt()
11928 xmlParserInputBufferPush(ctxt->input->buf, size, chunk); in xmlCreatePushParserCtxt()
11930 ctxt->input->base = ctxt->input->buf->buffer->content + base; in xmlCreatePushParserCtxt()
11931 ctxt->input->cur = ctxt->input->base + cur; in xmlCreatePushParserCtxt()
11932 ctxt->input->end = in xmlCreatePushParserCtxt()
11933 &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; in xmlCreatePushParserCtxt()
11940 xmlSwitchEncoding(ctxt, enc); in xmlCreatePushParserCtxt()
11943 return(ctxt); in xmlCreatePushParserCtxt()
11954 xmlStopParser(xmlParserCtxtPtr ctxt) { in xmlStopParser() argument
11955 if (ctxt == NULL) in xmlStopParser()
11957 ctxt->instate = XML_PARSER_EOF; in xmlStopParser()
11958 ctxt->disableSAX = 1; in xmlStopParser()
11959 if (ctxt->input != NULL) { in xmlStopParser()
11960 ctxt->input->cur = BAD_CAST""; in xmlStopParser()
11961 ctxt->input->base = ctxt->input->cur; in xmlStopParser()
11983 xmlParserCtxtPtr ctxt; in xmlCreateIOParserCtxt() local
11992 ctxt = xmlNewParserCtxt(); in xmlCreateIOParserCtxt()
11993 if (ctxt == NULL) { in xmlCreateIOParserCtxt()
11999 if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler) in xmlCreateIOParserCtxt()
12001 xmlFree(ctxt->sax); in xmlCreateIOParserCtxt()
12002 ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler)); in xmlCreateIOParserCtxt()
12003 if (ctxt->sax == NULL) { in xmlCreateIOParserCtxt()
12004 xmlErrMemory(ctxt, NULL); in xmlCreateIOParserCtxt()
12005 xmlFreeParserCtxt(ctxt); in xmlCreateIOParserCtxt()
12008 memset(ctxt->sax, 0, sizeof(xmlSAXHandler)); in xmlCreateIOParserCtxt()
12010 memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler)); in xmlCreateIOParserCtxt()
12012 memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1)); in xmlCreateIOParserCtxt()
12014 ctxt->userData = user_data; in xmlCreateIOParserCtxt()
12017 inputStream = xmlNewIOInputStream(ctxt, buf, enc); in xmlCreateIOParserCtxt()
12019 xmlFreeParserCtxt(ctxt); in xmlCreateIOParserCtxt()
12022 inputPush(ctxt, inputStream); in xmlCreateIOParserCtxt()
12024 return(ctxt); in xmlCreateIOParserCtxt()
12050 xmlParserCtxtPtr ctxt; in xmlIOParseDTD() local
12057 ctxt = xmlNewParserCtxt(); in xmlIOParseDTD()
12058 if (ctxt == NULL) { in xmlIOParseDTD()
12067 if (ctxt->sax != NULL) in xmlIOParseDTD()
12068 xmlFree(ctxt->sax); in xmlIOParseDTD()
12069 ctxt->sax = sax; in xmlIOParseDTD()
12070 ctxt->userData = ctxt; in xmlIOParseDTD()
12072 xmlDetectSAX2(ctxt); in xmlIOParseDTD()
12078 pinput = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in xmlIOParseDTD()
12080 if (sax != NULL) ctxt->sax = NULL; in xmlIOParseDTD()
12082 xmlFreeParserCtxt(ctxt); in xmlIOParseDTD()
12089 if (xmlPushInput(ctxt, pinput) < 0) { in xmlIOParseDTD()
12090 if (sax != NULL) ctxt->sax = NULL; in xmlIOParseDTD()
12091 xmlFreeParserCtxt(ctxt); in xmlIOParseDTD()
12095 xmlSwitchEncoding(ctxt, enc); in xmlIOParseDTD()
12101 pinput->base = ctxt->input->cur; in xmlIOParseDTD()
12102 pinput->cur = ctxt->input->cur; in xmlIOParseDTD()
12108 ctxt->inSubset = 2; in xmlIOParseDTD()
12109 ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0"); in xmlIOParseDTD()
12110 if (ctxt->myDoc == NULL) { in xmlIOParseDTD()
12111 xmlErrMemory(ctxt, "New Doc failed"); in xmlIOParseDTD()
12114 ctxt->myDoc->properties = XML_DOC_INTERNAL; in xmlIOParseDTD()
12115 ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none", in xmlIOParseDTD()
12119 ((ctxt->input->end - ctxt->input->cur) >= 4)) { in xmlIOParseDTD()
12131 xmlSwitchEncoding(ctxt, enc); in xmlIOParseDTD()
12135 xmlParseExternalSubset(ctxt, BAD_CAST "none", BAD_CAST "none"); in xmlIOParseDTD()
12137 if (ctxt->myDoc != NULL) { in xmlIOParseDTD()
12138 if (ctxt->wellFormed) { in xmlIOParseDTD()
12139 ret = ctxt->myDoc->extSubset; in xmlIOParseDTD()
12140 ctxt->myDoc->extSubset = NULL; in xmlIOParseDTD()
12154 xmlFreeDoc(ctxt->myDoc); in xmlIOParseDTD()
12155 ctxt->myDoc = NULL; in xmlIOParseDTD()
12157 if (sax != NULL) ctxt->sax = NULL; in xmlIOParseDTD()
12158 xmlFreeParserCtxt(ctxt); in xmlIOParseDTD()
12178 xmlParserCtxtPtr ctxt; in xmlSAXParseDTD() local
12185 ctxt = xmlNewParserCtxt(); in xmlSAXParseDTD()
12186 if (ctxt == NULL) { in xmlSAXParseDTD()
12194 if (ctxt->sax != NULL) in xmlSAXParseDTD()
12195 xmlFree(ctxt->sax); in xmlSAXParseDTD()
12196 ctxt->sax = sax; in xmlSAXParseDTD()
12197 ctxt->userData = ctxt; in xmlSAXParseDTD()
12205 xmlFreeParserCtxt(ctxt); in xmlSAXParseDTD()
12213 if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL)) in xmlSAXParseDTD()
12214 input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID, in xmlSAXParseDTD()
12217 if (sax != NULL) ctxt->sax = NULL; in xmlSAXParseDTD()
12218 xmlFreeParserCtxt(ctxt); in xmlSAXParseDTD()
12227 if (xmlPushInput(ctxt, input) < 0) { in xmlSAXParseDTD()
12228 if (sax != NULL) ctxt->sax = NULL; in xmlSAXParseDTD()
12229 xmlFreeParserCtxt(ctxt); in xmlSAXParseDTD()
12234 if ((ctxt->input->end - ctxt->input->cur) >= 4) { in xmlSAXParseDTD()
12235 enc = xmlDetectCharEncoding(ctxt->input->cur, 4); in xmlSAXParseDTD()
12236 xmlSwitchEncoding(ctxt, enc); in xmlSAXParseDTD()
12245 input->base = ctxt->input->cur; in xmlSAXParseDTD()
12246 input->cur = ctxt->input->cur; in xmlSAXParseDTD()
12252 ctxt->inSubset = 2; in xmlSAXParseDTD()
12253 ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0"); in xmlSAXParseDTD()
12254 if (ctxt->myDoc == NULL) { in xmlSAXParseDTD()
12255 xmlErrMemory(ctxt, "New Doc failed"); in xmlSAXParseDTD()
12256 if (sax != NULL) ctxt->sax = NULL; in xmlSAXParseDTD()
12257 xmlFreeParserCtxt(ctxt); in xmlSAXParseDTD()
12260 ctxt->myDoc->properties = XML_DOC_INTERNAL; in xmlSAXParseDTD()
12261 ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none", in xmlSAXParseDTD()
12263 xmlParseExternalSubset(ctxt, ExternalID, SystemID); in xmlSAXParseDTD()
12265 if (ctxt->myDoc != NULL) { in xmlSAXParseDTD()
12266 if (ctxt->wellFormed) { in xmlSAXParseDTD()
12267 ret = ctxt->myDoc->extSubset; in xmlSAXParseDTD()
12268 ctxt->myDoc->extSubset = NULL; in xmlSAXParseDTD()
12282 xmlFreeDoc(ctxt->myDoc); in xmlSAXParseDTD()
12283 ctxt->myDoc = NULL; in xmlSAXParseDTD()
12285 if (sax != NULL) ctxt->sax = NULL; in xmlSAXParseDTD()
12286 xmlFreeParserCtxt(ctxt); in xmlSAXParseDTD()
12334 xmlParserCtxtPtr ctxt; in xmlParseCtxtExternalEntity() local
12356 ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, ctx); in xmlParseCtxtExternalEntity()
12357 if (ctxt == NULL) { in xmlParseCtxtExternalEntity()
12361 oldsax = ctxt->sax; in xmlParseCtxtExternalEntity()
12362 ctxt->sax = ctx->sax; in xmlParseCtxtExternalEntity()
12363 xmlDetectSAX2(ctxt); in xmlParseCtxtExternalEntity()
12366 xmlFreeParserCtxt(ctxt); in xmlParseCtxtExternalEntity()
12383 ctxt->sax = oldsax; in xmlParseCtxtExternalEntity()
12384 xmlFreeParserCtxt(ctxt); in xmlParseCtxtExternalEntity()
12391 nodePush(ctxt, newDoc->children); in xmlParseCtxtExternalEntity()
12393 ctxt->myDoc = newDoc; in xmlParseCtxtExternalEntity()
12395 ctxt->myDoc = ctx->myDoc; in xmlParseCtxtExternalEntity()
12405 if ((ctxt->input->end - ctxt->input->cur) >= 4) { in xmlParseCtxtExternalEntity()
12412 xmlSwitchEncoding(ctxt, enc); in xmlParseCtxtExternalEntity()
12420 xmlParseTextDecl(ctxt); in xmlParseCtxtExternalEntity()
12425 (!xmlStrEqual(ctxt->input->version, BAD_CAST "1.0"))) { in xmlParseCtxtExternalEntity()
12426 xmlFatalErrMsg(ctxt, XML_ERR_VERSION_MISMATCH, in xmlParseCtxtExternalEntity()
12434 ctxt->instate = XML_PARSER_CONTENT; in xmlParseCtxtExternalEntity()
12435 ctxt->validate = ctx->validate; in xmlParseCtxtExternalEntity()
12436 ctxt->valid = ctx->valid; in xmlParseCtxtExternalEntity()
12437 ctxt->loadsubset = ctx->loadsubset; in xmlParseCtxtExternalEntity()
12438 ctxt->depth = ctx->depth + 1; in xmlParseCtxtExternalEntity()
12439 ctxt->replaceEntities = ctx->replaceEntities; in xmlParseCtxtExternalEntity()
12440 if (ctxt->validate) { in xmlParseCtxtExternalEntity()
12441 ctxt->vctxt.error = ctx->vctxt.error; in xmlParseCtxtExternalEntity()
12442 ctxt->vctxt.warning = ctx->vctxt.warning; in xmlParseCtxtExternalEntity()
12444 ctxt->vctxt.error = NULL; in xmlParseCtxtExternalEntity()
12445 ctxt->vctxt.warning = NULL; in xmlParseCtxtExternalEntity()
12447 ctxt->vctxt.nodeTab = NULL; in xmlParseCtxtExternalEntity()
12448 ctxt->vctxt.nodeNr = 0; in xmlParseCtxtExternalEntity()
12449 ctxt->vctxt.nodeMax = 0; in xmlParseCtxtExternalEntity()
12450 ctxt->vctxt.node = NULL; in xmlParseCtxtExternalEntity()
12451 if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); in xmlParseCtxtExternalEntity()
12452 ctxt->dict = ctx->dict; in xmlParseCtxtExternalEntity()
12453 ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); in xmlParseCtxtExternalEntity()
12454 ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); in xmlParseCtxtExternalEntity()
12455 ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); in xmlParseCtxtExternalEntity()
12456 ctxt->dictNames = ctx->dictNames; in xmlParseCtxtExternalEntity()
12457 ctxt->attsDefault = ctx->attsDefault; in xmlParseCtxtExternalEntity()
12458 ctxt->attsSpecial = ctx->attsSpecial; in xmlParseCtxtExternalEntity()
12459 ctxt->linenumbers = ctx->linenumbers; in xmlParseCtxtExternalEntity()
12461 xmlParseContent(ctxt); in xmlParseCtxtExternalEntity()
12463 ctx->validate = ctxt->validate; in xmlParseCtxtExternalEntity()
12464 ctx->valid = ctxt->valid; in xmlParseCtxtExternalEntity()
12466 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseCtxtExternalEntity()
12468 xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); in xmlParseCtxtExternalEntity()
12470 if (ctxt->node != newDoc->children) { in xmlParseCtxtExternalEntity()
12471 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseCtxtExternalEntity()
12474 if (!ctxt->wellFormed) { in xmlParseCtxtExternalEntity()
12475 if (ctxt->errNo == 0) in xmlParseCtxtExternalEntity()
12478 ret = ctxt->errNo; in xmlParseCtxtExternalEntity()
12497 ctxt->sax = oldsax; in xmlParseCtxtExternalEntity()
12498 ctxt->dict = NULL; in xmlParseCtxtExternalEntity()
12499 ctxt->attsDefault = NULL; in xmlParseCtxtExternalEntity()
12500 ctxt->attsSpecial = NULL; in xmlParseCtxtExternalEntity()
12501 xmlFreeParserCtxt(ctxt); in xmlParseCtxtExternalEntity()
12531 xmlParserCtxtPtr ctxt; in xmlParseExternalEntityPrivate() local
12553 ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, oldctxt); in xmlParseExternalEntityPrivate()
12554 if (ctxt == NULL) return(XML_WAR_UNDECLARED_ENTITY); in xmlParseExternalEntityPrivate()
12555 ctxt->userData = ctxt; in xmlParseExternalEntityPrivate()
12557 ctxt->_private = oldctxt->_private; in xmlParseExternalEntityPrivate()
12558 ctxt->loadsubset = oldctxt->loadsubset; in xmlParseExternalEntityPrivate()
12559 ctxt->validate = oldctxt->validate; in xmlParseExternalEntityPrivate()
12560 ctxt->external = oldctxt->external; in xmlParseExternalEntityPrivate()
12561 ctxt->record_info = oldctxt->record_info; in xmlParseExternalEntityPrivate()
12562 ctxt->node_seq.maximum = oldctxt->node_seq.maximum; in xmlParseExternalEntityPrivate()
12563 ctxt->node_seq.length = oldctxt->node_seq.length; in xmlParseExternalEntityPrivate()
12564 ctxt->node_seq.buffer = oldctxt->node_seq.buffer; in xmlParseExternalEntityPrivate()
12570 ctxt->_private = NULL; in xmlParseExternalEntityPrivate()
12571 ctxt->validate = 0; in xmlParseExternalEntityPrivate()
12572 ctxt->external = 2; in xmlParseExternalEntityPrivate()
12573 ctxt->loadsubset = 0; in xmlParseExternalEntityPrivate()
12576 oldsax = ctxt->sax; in xmlParseExternalEntityPrivate()
12577 ctxt->sax = sax; in xmlParseExternalEntityPrivate()
12579 ctxt->userData = user_data; in xmlParseExternalEntityPrivate()
12581 xmlDetectSAX2(ctxt); in xmlParseExternalEntityPrivate()
12584 ctxt->node_seq.maximum = 0; in xmlParseExternalEntityPrivate()
12585 ctxt->node_seq.length = 0; in xmlParseExternalEntityPrivate()
12586 ctxt->node_seq.buffer = NULL; in xmlParseExternalEntityPrivate()
12587 xmlFreeParserCtxt(ctxt); in xmlParseExternalEntityPrivate()
12602 ctxt->sax = oldsax; in xmlParseExternalEntityPrivate()
12603 ctxt->node_seq.maximum = 0; in xmlParseExternalEntityPrivate()
12604 ctxt->node_seq.length = 0; in xmlParseExternalEntityPrivate()
12605 ctxt->node_seq.buffer = NULL; in xmlParseExternalEntityPrivate()
12606 xmlFreeParserCtxt(ctxt); in xmlParseExternalEntityPrivate()
12613 nodePush(ctxt, newDoc->children); in xmlParseExternalEntityPrivate()
12614 ctxt->myDoc = doc; in xmlParseExternalEntityPrivate()
12623 if ((ctxt->input->end - ctxt->input->cur) >= 4) { in xmlParseExternalEntityPrivate()
12630 xmlSwitchEncoding(ctxt, enc); in xmlParseExternalEntityPrivate()
12638 xmlParseTextDecl(ctxt); in xmlParseExternalEntityPrivate()
12641 ctxt->instate = XML_PARSER_CONTENT; in xmlParseExternalEntityPrivate()
12642 ctxt->depth = depth; in xmlParseExternalEntityPrivate()
12644 xmlParseContent(ctxt); in xmlParseExternalEntityPrivate()
12647 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseExternalEntityPrivate()
12649 xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); in xmlParseExternalEntityPrivate()
12651 if (ctxt->node != newDoc->children) { in xmlParseExternalEntityPrivate()
12652 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseExternalEntityPrivate()
12655 if (!ctxt->wellFormed) { in xmlParseExternalEntityPrivate()
12656 if (ctxt->errNo == 0) in xmlParseExternalEntityPrivate()
12659 ret = (xmlParserErrors)ctxt->errNo; in xmlParseExternalEntityPrivate()
12684 oldctxt->nbentities += ctxt->nbentities; in xmlParseExternalEntityPrivate()
12689 if (ctxt->input != NULL) { in xmlParseExternalEntityPrivate()
12690 oldctxt->sizeentities += ctxt->input->consumed; in xmlParseExternalEntityPrivate()
12691 oldctxt->sizeentities += (ctxt->input->cur - ctxt->input->base); in xmlParseExternalEntityPrivate()
12696 if (ctxt->lastError.code != XML_ERR_OK) in xmlParseExternalEntityPrivate()
12697 xmlCopyError(&ctxt->lastError, &oldctxt->lastError); in xmlParseExternalEntityPrivate()
12700 ctxt->sax = oldsax; in xmlParseExternalEntityPrivate()
12701 oldctxt->node_seq.maximum = ctxt->node_seq.maximum; in xmlParseExternalEntityPrivate()
12702 oldctxt->node_seq.length = ctxt->node_seq.length; in xmlParseExternalEntityPrivate()
12703 oldctxt->node_seq.buffer = ctxt->node_seq.buffer; in xmlParseExternalEntityPrivate()
12704 ctxt->node_seq.maximum = 0; in xmlParseExternalEntityPrivate()
12705 ctxt->node_seq.length = 0; in xmlParseExternalEntityPrivate()
12706 ctxt->node_seq.buffer = NULL; in xmlParseExternalEntityPrivate()
12707 xmlFreeParserCtxt(ctxt); in xmlParseExternalEntityPrivate()
12795 xmlParserCtxtPtr ctxt; in xmlParseBalancedChunkMemoryInternal() local
12820 ctxt = xmlCreateMemoryParserCtxt((char *) string, size); in xmlParseBalancedChunkMemoryInternal()
12821 if (ctxt == NULL) return(XML_WAR_UNDECLARED_ENTITY); in xmlParseBalancedChunkMemoryInternal()
12823 ctxt->userData = user_data; in xmlParseBalancedChunkMemoryInternal()
12825 ctxt->userData = ctxt; in xmlParseBalancedChunkMemoryInternal()
12826 if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); in xmlParseBalancedChunkMemoryInternal()
12827 ctxt->dict = oldctxt->dict; in xmlParseBalancedChunkMemoryInternal()
12828 ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); in xmlParseBalancedChunkMemoryInternal()
12829 ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); in xmlParseBalancedChunkMemoryInternal()
12830 ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); in xmlParseBalancedChunkMemoryInternal()
12835 nsPush(ctxt, oldctxt->nsTab[i], oldctxt->nsTab[i+1]); in xmlParseBalancedChunkMemoryInternal()
12839 oldsax = ctxt->sax; in xmlParseBalancedChunkMemoryInternal()
12840 ctxt->sax = oldctxt->sax; in xmlParseBalancedChunkMemoryInternal()
12841 xmlDetectSAX2(ctxt); in xmlParseBalancedChunkMemoryInternal()
12842 ctxt->replaceEntities = oldctxt->replaceEntities; in xmlParseBalancedChunkMemoryInternal()
12843 ctxt->options = oldctxt->options; in xmlParseBalancedChunkMemoryInternal()
12845 ctxt->_private = oldctxt->_private; in xmlParseBalancedChunkMemoryInternal()
12849 ctxt->sax = oldsax; in xmlParseBalancedChunkMemoryInternal()
12850 ctxt->dict = NULL; in xmlParseBalancedChunkMemoryInternal()
12851 xmlFreeParserCtxt(ctxt); in xmlParseBalancedChunkMemoryInternal()
12855 newDoc->dict = ctxt->dict; in xmlParseBalancedChunkMemoryInternal()
12857 ctxt->myDoc = newDoc; in xmlParseBalancedChunkMemoryInternal()
12859 ctxt->myDoc = oldctxt->myDoc; in xmlParseBalancedChunkMemoryInternal()
12860 content = ctxt->myDoc->children; in xmlParseBalancedChunkMemoryInternal()
12861 last = ctxt->myDoc->last; in xmlParseBalancedChunkMemoryInternal()
12863 newRoot = xmlNewDocNode(ctxt->myDoc, NULL, BAD_CAST "pseudoroot", NULL); in xmlParseBalancedChunkMemoryInternal()
12865 ctxt->sax = oldsax; in xmlParseBalancedChunkMemoryInternal()
12866 ctxt->dict = NULL; in xmlParseBalancedChunkMemoryInternal()
12867 xmlFreeParserCtxt(ctxt); in xmlParseBalancedChunkMemoryInternal()
12873 ctxt->myDoc->children = NULL; in xmlParseBalancedChunkMemoryInternal()
12874 ctxt->myDoc->last = NULL; in xmlParseBalancedChunkMemoryInternal()
12875 xmlAddChild((xmlNodePtr) ctxt->myDoc, newRoot); in xmlParseBalancedChunkMemoryInternal()
12876 nodePush(ctxt, ctxt->myDoc->children); in xmlParseBalancedChunkMemoryInternal()
12877 ctxt->instate = XML_PARSER_CONTENT; in xmlParseBalancedChunkMemoryInternal()
12878 ctxt->depth = oldctxt->depth + 1; in xmlParseBalancedChunkMemoryInternal()
12880 ctxt->validate = 0; in xmlParseBalancedChunkMemoryInternal()
12881 ctxt->loadsubset = oldctxt->loadsubset; in xmlParseBalancedChunkMemoryInternal()
12886 ctxt->loadsubset |= XML_SKIP_IDS; in xmlParseBalancedChunkMemoryInternal()
12888 ctxt->dictNames = oldctxt->dictNames; in xmlParseBalancedChunkMemoryInternal()
12889 ctxt->attsDefault = oldctxt->attsDefault; in xmlParseBalancedChunkMemoryInternal()
12890 ctxt->attsSpecial = oldctxt->attsSpecial; in xmlParseBalancedChunkMemoryInternal()
12892 xmlParseContent(ctxt); in xmlParseBalancedChunkMemoryInternal()
12894 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseBalancedChunkMemoryInternal()
12896 xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); in xmlParseBalancedChunkMemoryInternal()
12898 if (ctxt->node != ctxt->myDoc->children) { in xmlParseBalancedChunkMemoryInternal()
12899 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseBalancedChunkMemoryInternal()
12902 if (!ctxt->wellFormed) { in xmlParseBalancedChunkMemoryInternal()
12903 if (ctxt->errNo == 0) in xmlParseBalancedChunkMemoryInternal()
12906 ret = (xmlParserErrors)ctxt->errNo; in xmlParseBalancedChunkMemoryInternal()
12918 cur = ctxt->myDoc->children->children; in xmlParseBalancedChunkMemoryInternal()
12932 ctxt->myDoc->children->children = NULL; in xmlParseBalancedChunkMemoryInternal()
12934 if (ctxt->myDoc != NULL) { in xmlParseBalancedChunkMemoryInternal()
12935 xmlFreeNode(ctxt->myDoc->children); in xmlParseBalancedChunkMemoryInternal()
12936 ctxt->myDoc->children = content; in xmlParseBalancedChunkMemoryInternal()
12937 ctxt->myDoc->last = last; in xmlParseBalancedChunkMemoryInternal()
12945 oldctxt->nbentities += ctxt->nbentities; in xmlParseBalancedChunkMemoryInternal()
12950 if (ctxt->lastError.code != XML_ERR_OK) in xmlParseBalancedChunkMemoryInternal()
12951 xmlCopyError(&ctxt->lastError, &oldctxt->lastError); in xmlParseBalancedChunkMemoryInternal()
12953 ctxt->sax = oldsax; in xmlParseBalancedChunkMemoryInternal()
12954 ctxt->dict = NULL; in xmlParseBalancedChunkMemoryInternal()
12955 ctxt->attsDefault = NULL; in xmlParseBalancedChunkMemoryInternal()
12956 ctxt->attsSpecial = NULL; in xmlParseBalancedChunkMemoryInternal()
12957 xmlFreeParserCtxt(ctxt); in xmlParseBalancedChunkMemoryInternal()
12988 xmlParserCtxtPtr ctxt; in xmlParseInNodeContext() local
13033 ctxt = xmlCreateMemoryParserCtxt((char *) data, datalen); in xmlParseInNodeContext()
13036 ctxt = htmlCreateMemoryParserCtxt((char *) data, datalen); in xmlParseInNodeContext()
13047 if (ctxt == NULL) in xmlParseInNodeContext()
13056 if (ctxt->dict != NULL) in xmlParseInNodeContext()
13057 xmlDictFree(ctxt->dict); in xmlParseInNodeContext()
13058 ctxt->dict = doc->dict; in xmlParseInNodeContext()
13065 if (ctxt->encoding != NULL) in xmlParseInNodeContext()
13066 xmlFree((xmlChar *) ctxt->encoding); in xmlParseInNodeContext()
13067 ctxt->encoding = xmlStrdup((const xmlChar *) doc->encoding); in xmlParseInNodeContext()
13071 xmlSwitchToEncoding(ctxt, hdlr); in xmlParseInNodeContext()
13077 xmlCtxtUseOptionsInternal(ctxt, options, NULL); in xmlParseInNodeContext()
13078 xmlDetectSAX2(ctxt); in xmlParseInNodeContext()
13079 ctxt->myDoc = doc; in xmlParseInNodeContext()
13083 xmlFreeParserCtxt(ctxt); in xmlParseInNodeContext()
13089 nodePush(ctxt, node); in xmlParseInNodeContext()
13099 if (ctxt->dict) { in xmlParseInNodeContext()
13100 iprefix = xmlDictLookup(ctxt->dict, ns->prefix, -1); in xmlParseInNodeContext()
13101 ihref = xmlDictLookup(ctxt->dict, ns->href, -1); in xmlParseInNodeContext()
13107 if (xmlGetNamespace(ctxt, iprefix) == NULL) { in xmlParseInNodeContext()
13108 nsPush(ctxt, iprefix, ihref); in xmlParseInNodeContext()
13115 ctxt->instate = XML_PARSER_CONTENT; in xmlParseInNodeContext()
13118 if ((ctxt->validate) || (ctxt->replaceEntities != 0)) { in xmlParseInNodeContext()
13122 ctxt->loadsubset |= XML_SKIP_IDS; in xmlParseInNodeContext()
13127 __htmlParseContent(ctxt); in xmlParseInNodeContext()
13130 xmlParseContent(ctxt); in xmlParseInNodeContext()
13132 nsPop(ctxt, nsnr); in xmlParseInNodeContext()
13134 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseInNodeContext()
13136 xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); in xmlParseInNodeContext()
13138 if ((ctxt->node != NULL) && (ctxt->node != node)) { in xmlParseInNodeContext()
13139 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseInNodeContext()
13140 ctxt->wellFormed = 0; in xmlParseInNodeContext()
13143 if (!ctxt->wellFormed) { in xmlParseInNodeContext()
13144 if (ctxt->errNo == 0) in xmlParseInNodeContext()
13147 ret = (xmlParserErrors)ctxt->errNo; in xmlParseInNodeContext()
13182 ctxt->dict = NULL; in xmlParseInNodeContext()
13183 xmlFreeParserCtxt(ctxt); in xmlParseInNodeContext()
13221 xmlParserCtxtPtr ctxt; in xmlParseBalancedChunkMemoryRecover() local
13240 ctxt = xmlCreateMemoryParserCtxt((char *) string, size); in xmlParseBalancedChunkMemoryRecover()
13241 if (ctxt == NULL) return(-1); in xmlParseBalancedChunkMemoryRecover()
13242 ctxt->userData = ctxt; in xmlParseBalancedChunkMemoryRecover()
13244 oldsax = ctxt->sax; in xmlParseBalancedChunkMemoryRecover()
13245 ctxt->sax = sax; in xmlParseBalancedChunkMemoryRecover()
13247 ctxt->userData = user_data; in xmlParseBalancedChunkMemoryRecover()
13251 xmlFreeParserCtxt(ctxt); in xmlParseBalancedChunkMemoryRecover()
13256 xmlDictFree(ctxt->dict); in xmlParseBalancedChunkMemoryRecover()
13257 ctxt->dict = doc->dict; in xmlParseBalancedChunkMemoryRecover()
13258 xmlDictReference(ctxt->dict); in xmlParseBalancedChunkMemoryRecover()
13259 ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); in xmlParseBalancedChunkMemoryRecover()
13260 ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); in xmlParseBalancedChunkMemoryRecover()
13261 ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); in xmlParseBalancedChunkMemoryRecover()
13262 ctxt->dictNames = 1; in xmlParseBalancedChunkMemoryRecover()
13264 xmlCtxtUseOptionsInternal(ctxt, XML_PARSE_NODICT, NULL); in xmlParseBalancedChunkMemoryRecover()
13273 ctxt->sax = oldsax; in xmlParseBalancedChunkMemoryRecover()
13274 xmlFreeParserCtxt(ctxt); in xmlParseBalancedChunkMemoryRecover()
13281 nodePush(ctxt, newRoot); in xmlParseBalancedChunkMemoryRecover()
13283 ctxt->myDoc = newDoc; in xmlParseBalancedChunkMemoryRecover()
13285 ctxt->myDoc = newDoc; in xmlParseBalancedChunkMemoryRecover()
13291 ctxt->instate = XML_PARSER_CONTENT; in xmlParseBalancedChunkMemoryRecover()
13292 ctxt->depth = depth; in xmlParseBalancedChunkMemoryRecover()
13297 ctxt->validate = 0; in xmlParseBalancedChunkMemoryRecover()
13298 ctxt->loadsubset = 0; in xmlParseBalancedChunkMemoryRecover()
13299 xmlDetectSAX2(ctxt); in xmlParseBalancedChunkMemoryRecover()
13304 xmlParseContent(ctxt); in xmlParseBalancedChunkMemoryRecover()
13308 xmlParseContent(ctxt); in xmlParseBalancedChunkMemoryRecover()
13311 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseBalancedChunkMemoryRecover()
13313 xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); in xmlParseBalancedChunkMemoryRecover()
13315 if (ctxt->node != newDoc->children) { in xmlParseBalancedChunkMemoryRecover()
13316 xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); in xmlParseBalancedChunkMemoryRecover()
13319 if (!ctxt->wellFormed) { in xmlParseBalancedChunkMemoryRecover()
13320 if (ctxt->errNo == 0) in xmlParseBalancedChunkMemoryRecover()
13323 ret = ctxt->errNo; in xmlParseBalancedChunkMemoryRecover()
13346 ctxt->sax = oldsax; in xmlParseBalancedChunkMemoryRecover()
13347 xmlFreeParserCtxt(ctxt); in xmlParseBalancedChunkMemoryRecover()
13375 xmlParserCtxtPtr ctxt; in xmlSAXParseEntity() local
13377 ctxt = xmlCreateFileParserCtxt(filename); in xmlSAXParseEntity()
13378 if (ctxt == NULL) { in xmlSAXParseEntity()
13382 if (ctxt->sax != NULL) in xmlSAXParseEntity()
13383 xmlFree(ctxt->sax); in xmlSAXParseEntity()
13384 ctxt->sax = sax; in xmlSAXParseEntity()
13385 ctxt->userData = NULL; in xmlSAXParseEntity()
13388 xmlParseExtParsedEnt(ctxt); in xmlSAXParseEntity()
13390 if (ctxt->wellFormed) in xmlSAXParseEntity()
13391 ret = ctxt->myDoc; in xmlSAXParseEntity()
13394 xmlFreeDoc(ctxt->myDoc); in xmlSAXParseEntity()
13395 ctxt->myDoc = NULL; in xmlSAXParseEntity()
13398 ctxt->sax = NULL; in xmlSAXParseEntity()
13399 xmlFreeParserCtxt(ctxt); in xmlSAXParseEntity()
13439 xmlParserCtxtPtr ctxt; in xmlCreateEntityParserCtxtInternal() local
13444 ctxt = xmlNewParserCtxt(); in xmlCreateEntityParserCtxtInternal()
13445 if (ctxt == NULL) { in xmlCreateEntityParserCtxtInternal()
13450 ctxt->options = pctx->options; in xmlCreateEntityParserCtxtInternal()
13451 ctxt->_private = pctx->_private; in xmlCreateEntityParserCtxtInternal()
13457 inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt); in xmlCreateEntityParserCtxtInternal()
13459 xmlFreeParserCtxt(ctxt); in xmlCreateEntityParserCtxtInternal()
13463 inputPush(ctxt, inputStream); in xmlCreateEntityParserCtxtInternal()
13465 if ((ctxt->directory == NULL) && (directory == NULL)) in xmlCreateEntityParserCtxtInternal()
13467 if ((ctxt->directory == NULL) && (directory != NULL)) in xmlCreateEntityParserCtxtInternal()
13468 ctxt->directory = directory; in xmlCreateEntityParserCtxtInternal()
13470 inputStream = xmlLoadExternalEntity((char *)uri, (char *)ID, ctxt); in xmlCreateEntityParserCtxtInternal()
13473 xmlFreeParserCtxt(ctxt); in xmlCreateEntityParserCtxtInternal()
13477 inputPush(ctxt, inputStream); in xmlCreateEntityParserCtxtInternal()
13479 if ((ctxt->directory == NULL) && (directory == NULL)) in xmlCreateEntityParserCtxtInternal()
13481 if ((ctxt->directory == NULL) && (directory != NULL)) in xmlCreateEntityParserCtxtInternal()
13482 ctxt->directory = directory; in xmlCreateEntityParserCtxtInternal()
13485 return(ctxt); in xmlCreateEntityParserCtxtInternal()
13527 xmlParserCtxtPtr ctxt; in xmlCreateURLParserCtxt() local
13531 ctxt = xmlNewParserCtxt(); in xmlCreateURLParserCtxt()
13532 if (ctxt == NULL) { in xmlCreateURLParserCtxt()
13538 xmlCtxtUseOptionsInternal(ctxt, options, NULL); in xmlCreateURLParserCtxt()
13539 ctxt->linenumbers = 1; in xmlCreateURLParserCtxt()
13541 inputStream = xmlLoadExternalEntity(filename, NULL, ctxt); in xmlCreateURLParserCtxt()
13543 xmlFreeParserCtxt(ctxt); in xmlCreateURLParserCtxt()
13547 inputPush(ctxt, inputStream); in xmlCreateURLParserCtxt()
13548 if ((ctxt->directory == NULL) && (directory == NULL)) in xmlCreateURLParserCtxt()
13550 if ((ctxt->directory == NULL) && (directory != NULL)) in xmlCreateURLParserCtxt()
13551 ctxt->directory = directory; in xmlCreateURLParserCtxt()
13553 return(ctxt); in xmlCreateURLParserCtxt()
13596 xmlParserCtxtPtr ctxt; in xmlSAXParseFileWithData() local
13600 ctxt = xmlCreateFileParserCtxt(filename); in xmlSAXParseFileWithData()
13601 if (ctxt == NULL) { in xmlSAXParseFileWithData()
13605 if (ctxt->sax != NULL) in xmlSAXParseFileWithData()
13606 xmlFree(ctxt->sax); in xmlSAXParseFileWithData()
13607 ctxt->sax = sax; in xmlSAXParseFileWithData()
13609 xmlDetectSAX2(ctxt); in xmlSAXParseFileWithData()
13611 ctxt->_private = data; in xmlSAXParseFileWithData()
13614 if (ctxt->directory == NULL) in xmlSAXParseFileWithData()
13615 ctxt->directory = xmlParserGetDirectory(filename); in xmlSAXParseFileWithData()
13617 ctxt->recovery = recovery; in xmlSAXParseFileWithData()
13619 xmlParseDocument(ctxt); in xmlSAXParseFileWithData()
13621 if ((ctxt->wellFormed) || recovery) { in xmlSAXParseFileWithData()
13622 ret = ctxt->myDoc; in xmlSAXParseFileWithData()
13624 if (ctxt->input->buf->compressed > 0) in xmlSAXParseFileWithData()
13627 ret->compression = ctxt->input->buf->compressed; in xmlSAXParseFileWithData()
13632 xmlFreeDoc(ctxt->myDoc); in xmlSAXParseFileWithData()
13633 ctxt->myDoc = NULL; in xmlSAXParseFileWithData()
13636 ctxt->sax = NULL; in xmlSAXParseFileWithData()
13637 xmlFreeParserCtxt(ctxt); in xmlSAXParseFileWithData()
13724 xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer, in xmlSetupParserForBuffer() argument
13729 if ((ctxt == NULL) || (buffer == NULL)) in xmlSetupParserForBuffer()
13732 input = xmlNewInputStream(ctxt); in xmlSetupParserForBuffer()
13735 xmlClearParserCtxt(ctxt); in xmlSetupParserForBuffer()
13739 xmlClearParserCtxt(ctxt); in xmlSetupParserForBuffer()
13745 inputPush(ctxt, input); in xmlSetupParserForBuffer()
13763 xmlParserCtxtPtr ctxt; in xmlSAXUserParseFile() local
13765 ctxt = xmlCreateFileParserCtxt(filename); in xmlSAXUserParseFile()
13766 if (ctxt == NULL) return -1; in xmlSAXUserParseFile()
13767 if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler) in xmlSAXUserParseFile()
13768 xmlFree(ctxt->sax); in xmlSAXUserParseFile()
13769 ctxt->sax = sax; in xmlSAXUserParseFile()
13770 xmlDetectSAX2(ctxt); in xmlSAXUserParseFile()
13773 ctxt->userData = user_data; in xmlSAXUserParseFile()
13775 xmlParseDocument(ctxt); in xmlSAXUserParseFile()
13777 if (ctxt->wellFormed) in xmlSAXUserParseFile()
13780 if (ctxt->errNo != 0) in xmlSAXUserParseFile()
13781 ret = ctxt->errNo; in xmlSAXUserParseFile()
13786 ctxt->sax = NULL; in xmlSAXUserParseFile()
13787 if (ctxt->myDoc != NULL) { in xmlSAXUserParseFile()
13788 xmlFreeDoc(ctxt->myDoc); in xmlSAXUserParseFile()
13789 ctxt->myDoc = NULL; in xmlSAXUserParseFile()
13791 xmlFreeParserCtxt(ctxt); in xmlSAXUserParseFile()
13814 xmlParserCtxtPtr ctxt; in xmlCreateMemoryParserCtxt() local
13823 ctxt = xmlNewParserCtxt(); in xmlCreateMemoryParserCtxt()
13824 if (ctxt == NULL) in xmlCreateMemoryParserCtxt()
13830 xmlFreeParserCtxt(ctxt); in xmlCreateMemoryParserCtxt()
13834 input = xmlNewInputStream(ctxt); in xmlCreateMemoryParserCtxt()
13837 xmlFreeParserCtxt(ctxt); in xmlCreateMemoryParserCtxt()
13847 inputPush(ctxt, input); in xmlCreateMemoryParserCtxt()
13848 return(ctxt); in xmlCreateMemoryParserCtxt()
13875 xmlParserCtxtPtr ctxt; in xmlSAXParseMemoryWithData() local
13879 ctxt = xmlCreateMemoryParserCtxt(buffer, size); in xmlSAXParseMemoryWithData()
13880 if (ctxt == NULL) return(NULL); in xmlSAXParseMemoryWithData()
13882 if (ctxt->sax != NULL) in xmlSAXParseMemoryWithData()
13883 xmlFree(ctxt->sax); in xmlSAXParseMemoryWithData()
13884 ctxt->sax = sax; in xmlSAXParseMemoryWithData()
13886 xmlDetectSAX2(ctxt); in xmlSAXParseMemoryWithData()
13888 ctxt->_private=data; in xmlSAXParseMemoryWithData()
13891 ctxt->recovery = recovery; in xmlSAXParseMemoryWithData()
13893 xmlParseDocument(ctxt); in xmlSAXParseMemoryWithData()
13895 if ((ctxt->wellFormed) || recovery) ret = ctxt->myDoc; in xmlSAXParseMemoryWithData()
13898 xmlFreeDoc(ctxt->myDoc); in xmlSAXParseMemoryWithData()
13899 ctxt->myDoc = NULL; in xmlSAXParseMemoryWithData()
13902 ctxt->sax = NULL; in xmlSAXParseMemoryWithData()
13903 xmlFreeParserCtxt(ctxt); in xmlSAXParseMemoryWithData()
13973 xmlParserCtxtPtr ctxt; in xmlSAXUserParseMemory() local
13977 ctxt = xmlCreateMemoryParserCtxt(buffer, size); in xmlSAXUserParseMemory()
13978 if (ctxt == NULL) return -1; in xmlSAXUserParseMemory()
13979 if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler) in xmlSAXUserParseMemory()
13980 xmlFree(ctxt->sax); in xmlSAXUserParseMemory()
13981 ctxt->sax = sax; in xmlSAXUserParseMemory()
13982 xmlDetectSAX2(ctxt); in xmlSAXUserParseMemory()
13985 ctxt->userData = user_data; in xmlSAXUserParseMemory()
13987 xmlParseDocument(ctxt); in xmlSAXUserParseMemory()
13989 if (ctxt->wellFormed) in xmlSAXUserParseMemory()
13992 if (ctxt->errNo != 0) in xmlSAXUserParseMemory()
13993 ret = ctxt->errNo; in xmlSAXUserParseMemory()
13998 ctxt->sax = NULL; in xmlSAXUserParseMemory()
13999 if (ctxt->myDoc != NULL) { in xmlSAXUserParseMemory()
14000 xmlFreeDoc(ctxt->myDoc); in xmlSAXUserParseMemory()
14001 ctxt->myDoc = NULL; in xmlSAXUserParseMemory()
14003 xmlFreeParserCtxt(ctxt); in xmlSAXUserParseMemory()
14045 xmlParserCtxtPtr ctxt; in xmlSAXParseDoc() local
14051 ctxt = xmlCreateDocParserCtxt(cur); in xmlSAXParseDoc()
14052 if (ctxt == NULL) return(NULL); in xmlSAXParseDoc()
14054 oldsax = ctxt->sax; in xmlSAXParseDoc()
14055 ctxt->sax = sax; in xmlSAXParseDoc()
14056 ctxt->userData = NULL; in xmlSAXParseDoc()
14058 xmlDetectSAX2(ctxt); in xmlSAXParseDoc()
14060 xmlParseDocument(ctxt); in xmlSAXParseDoc()
14061 if ((ctxt->wellFormed) || recovery) ret = ctxt->myDoc; in xmlSAXParseDoc()
14064 xmlFreeDoc(ctxt->myDoc); in xmlSAXParseDoc()
14065 ctxt->myDoc = NULL; in xmlSAXParseDoc()
14068 ctxt->sax = oldsax; in xmlSAXParseDoc()
14069 xmlFreeParserCtxt(ctxt); in xmlSAXParseDoc()
14258 xmlCtxtReset(xmlParserCtxtPtr ctxt) in xmlCtxtReset() argument
14263 if (ctxt == NULL) in xmlCtxtReset()
14266 dict = ctxt->dict; in xmlCtxtReset()
14268 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ in xmlCtxtReset()
14271 ctxt->inputNr = 0; in xmlCtxtReset()
14272 ctxt->input = NULL; in xmlCtxtReset()
14274 ctxt->spaceNr = 0; in xmlCtxtReset()
14275 if (ctxt->spaceTab != NULL) { in xmlCtxtReset()
14276 ctxt->spaceTab[0] = -1; in xmlCtxtReset()
14277 ctxt->space = &ctxt->spaceTab[0]; in xmlCtxtReset()
14279 ctxt->space = NULL; in xmlCtxtReset()
14283 ctxt->nodeNr = 0; in xmlCtxtReset()
14284 ctxt->node = NULL; in xmlCtxtReset()
14286 ctxt->nameNr = 0; in xmlCtxtReset()
14287 ctxt->name = NULL; in xmlCtxtReset()
14289 DICT_FREE(ctxt->version); in xmlCtxtReset()
14290 ctxt->version = NULL; in xmlCtxtReset()
14291 DICT_FREE(ctxt->encoding); in xmlCtxtReset()
14292 ctxt->encoding = NULL; in xmlCtxtReset()
14293 DICT_FREE(ctxt->directory); in xmlCtxtReset()
14294 ctxt->directory = NULL; in xmlCtxtReset()
14295 DICT_FREE(ctxt->extSubURI); in xmlCtxtReset()
14296 ctxt->extSubURI = NULL; in xmlCtxtReset()
14297 DICT_FREE(ctxt->extSubSystem); in xmlCtxtReset()
14298 ctxt->extSubSystem = NULL; in xmlCtxtReset()
14299 if (ctxt->myDoc != NULL) in xmlCtxtReset()
14300 xmlFreeDoc(ctxt->myDoc); in xmlCtxtReset()
14301 ctxt->myDoc = NULL; in xmlCtxtReset()
14303 ctxt->standalone = -1; in xmlCtxtReset()
14304 ctxt->hasExternalSubset = 0; in xmlCtxtReset()
14305 ctxt->hasPErefs = 0; in xmlCtxtReset()
14306 ctxt->html = 0; in xmlCtxtReset()
14307 ctxt->external = 0; in xmlCtxtReset()
14308 ctxt->instate = XML_PARSER_START; in xmlCtxtReset()
14309 ctxt->token = 0; in xmlCtxtReset()
14311 ctxt->wellFormed = 1; in xmlCtxtReset()
14312 ctxt->nsWellFormed = 1; in xmlCtxtReset()
14313 ctxt->disableSAX = 0; in xmlCtxtReset()
14314 ctxt->valid = 1; in xmlCtxtReset()
14316 ctxt->vctxt.userData = ctxt; in xmlCtxtReset()
14317 ctxt->vctxt.error = xmlParserValidityError; in xmlCtxtReset()
14318 ctxt->vctxt.warning = xmlParserValidityWarning; in xmlCtxtReset()
14320 ctxt->record_info = 0; in xmlCtxtReset()
14321 ctxt->nbChars = 0; in xmlCtxtReset()
14322 ctxt->checkIndex = 0; in xmlCtxtReset()
14323 ctxt->inSubset = 0; in xmlCtxtReset()
14324 ctxt->errNo = XML_ERR_OK; in xmlCtxtReset()
14325 ctxt->depth = 0; in xmlCtxtReset()
14326 ctxt->charset = XML_CHAR_ENCODING_UTF8; in xmlCtxtReset()
14327 ctxt->catalogs = NULL; in xmlCtxtReset()
14328 ctxt->nbentities = 0; in xmlCtxtReset()
14329 ctxt->sizeentities = 0; in xmlCtxtReset()
14330 xmlInitNodeInfoSeq(&ctxt->node_seq); in xmlCtxtReset()
14332 if (ctxt->attsDefault != NULL) { in xmlCtxtReset()
14333 xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); in xmlCtxtReset()
14334 ctxt->attsDefault = NULL; in xmlCtxtReset()
14336 if (ctxt->attsSpecial != NULL) { in xmlCtxtReset()
14337 xmlHashFree(ctxt->attsSpecial, NULL); in xmlCtxtReset()
14338 ctxt->attsSpecial = NULL; in xmlCtxtReset()
14342 if (ctxt->catalogs != NULL) in xmlCtxtReset()
14343 xmlCatalogFreeLocal(ctxt->catalogs); in xmlCtxtReset()
14345 if (ctxt->lastError.code != XML_ERR_OK) in xmlCtxtReset()
14346 xmlResetError(&ctxt->lastError); in xmlCtxtReset()
14362 xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk, in xmlCtxtResetPush() argument
14369 if (ctxt == NULL) in xmlCtxtResetPush()
14379 if (ctxt == NULL) { in xmlCtxtResetPush()
14384 xmlCtxtReset(ctxt); in xmlCtxtResetPush()
14386 if (ctxt->pushTab == NULL) { in xmlCtxtResetPush()
14387 ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 * in xmlCtxtResetPush()
14389 if (ctxt->pushTab == NULL) { in xmlCtxtResetPush()
14390 xmlErrMemory(ctxt, NULL); in xmlCtxtResetPush()
14397 ctxt->directory = NULL; in xmlCtxtResetPush()
14399 ctxt->directory = xmlParserGetDirectory(filename); in xmlCtxtResetPush()
14402 inputStream = xmlNewInputStream(ctxt); in xmlCtxtResetPush()
14419 inputPush(ctxt, inputStream); in xmlCtxtResetPush()
14421 if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && in xmlCtxtResetPush()
14422 (ctxt->input->buf != NULL)) { in xmlCtxtResetPush()
14423 int base = ctxt->input->base - ctxt->input->buf->buffer->content; in xmlCtxtResetPush()
14424 int cur = ctxt->input->cur - ctxt->input->base; in xmlCtxtResetPush()
14426 xmlParserInputBufferPush(ctxt->input->buf, size, chunk); in xmlCtxtResetPush()
14428 ctxt->input->base = ctxt->input->buf->buffer->content + base; in xmlCtxtResetPush()
14429 ctxt->input->cur = ctxt->input->base + cur; in xmlCtxtResetPush()
14430 ctxt->input->end = in xmlCtxtResetPush()
14431 &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer-> in xmlCtxtResetPush()
14441 if (ctxt->encoding != NULL) in xmlCtxtResetPush()
14442 xmlFree((xmlChar *) ctxt->encoding); in xmlCtxtResetPush()
14443 ctxt->encoding = xmlStrdup((const xmlChar *) encoding); in xmlCtxtResetPush()
14447 xmlSwitchToEncoding(ctxt, hdlr); in xmlCtxtResetPush()
14449 xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlCtxtResetPush()
14453 xmlSwitchEncoding(ctxt, enc); in xmlCtxtResetPush()
14472 xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding) in xmlCtxtUseOptionsInternal() argument
14474 if (ctxt == NULL) in xmlCtxtUseOptionsInternal()
14477 if (ctxt->encoding != NULL) in xmlCtxtUseOptionsInternal()
14478 xmlFree((xmlChar *) ctxt->encoding); in xmlCtxtUseOptionsInternal()
14479 ctxt->encoding = xmlStrdup((const xmlChar *) encoding); in xmlCtxtUseOptionsInternal()
14482 ctxt->recovery = 1; in xmlCtxtUseOptionsInternal()
14484 ctxt->options |= XML_PARSE_RECOVER; in xmlCtxtUseOptionsInternal()
14486 ctxt->recovery = 0; in xmlCtxtUseOptionsInternal()
14488 ctxt->loadsubset = XML_DETECT_IDS; in xmlCtxtUseOptionsInternal()
14490 ctxt->options |= XML_PARSE_DTDLOAD; in xmlCtxtUseOptionsInternal()
14492 ctxt->loadsubset = 0; in xmlCtxtUseOptionsInternal()
14494 ctxt->loadsubset |= XML_COMPLETE_ATTRS; in xmlCtxtUseOptionsInternal()
14496 ctxt->options |= XML_PARSE_DTDATTR; in xmlCtxtUseOptionsInternal()
14499 ctxt->replaceEntities = 1; in xmlCtxtUseOptionsInternal()
14502 ctxt->options |= XML_PARSE_NOENT; in xmlCtxtUseOptionsInternal()
14504 ctxt->replaceEntities = 0; in xmlCtxtUseOptionsInternal()
14506 ctxt->pedantic = 1; in xmlCtxtUseOptionsInternal()
14508 ctxt->options |= XML_PARSE_PEDANTIC; in xmlCtxtUseOptionsInternal()
14510 ctxt->pedantic = 0; in xmlCtxtUseOptionsInternal()
14512 ctxt->keepBlanks = 0; in xmlCtxtUseOptionsInternal()
14513 ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace; in xmlCtxtUseOptionsInternal()
14515 ctxt->options |= XML_PARSE_NOBLANKS; in xmlCtxtUseOptionsInternal()
14517 ctxt->keepBlanks = 1; in xmlCtxtUseOptionsInternal()
14519 ctxt->validate = 1; in xmlCtxtUseOptionsInternal()
14521 ctxt->vctxt.warning = NULL; in xmlCtxtUseOptionsInternal()
14523 ctxt->vctxt.error = NULL; in xmlCtxtUseOptionsInternal()
14525 ctxt->options |= XML_PARSE_DTDVALID; in xmlCtxtUseOptionsInternal()
14527 ctxt->validate = 0; in xmlCtxtUseOptionsInternal()
14529 ctxt->sax->warning = NULL; in xmlCtxtUseOptionsInternal()
14533 ctxt->sax->error = NULL; in xmlCtxtUseOptionsInternal()
14534 ctxt->sax->fatalError = NULL; in xmlCtxtUseOptionsInternal()
14539 ctxt->sax->startElement = xmlSAX2StartElement; in xmlCtxtUseOptionsInternal()
14540 ctxt->sax->endElement = xmlSAX2EndElement; in xmlCtxtUseOptionsInternal()
14541 ctxt->sax->startElementNs = NULL; in xmlCtxtUseOptionsInternal()
14542 ctxt->sax->endElementNs = NULL; in xmlCtxtUseOptionsInternal()
14543 ctxt->sax->initialized = 1; in xmlCtxtUseOptionsInternal()
14545 ctxt->options |= XML_PARSE_SAX1; in xmlCtxtUseOptionsInternal()
14549 ctxt->dictNames = 0; in xmlCtxtUseOptionsInternal()
14551 ctxt->options |= XML_PARSE_NODICT; in xmlCtxtUseOptionsInternal()
14553 ctxt->dictNames = 1; in xmlCtxtUseOptionsInternal()
14556 ctxt->sax->cdataBlock = NULL; in xmlCtxtUseOptionsInternal()
14558 ctxt->options |= XML_PARSE_NOCDATA; in xmlCtxtUseOptionsInternal()
14561 ctxt->options |= XML_PARSE_NSCLEAN; in xmlCtxtUseOptionsInternal()
14565 ctxt->options |= XML_PARSE_NONET; in xmlCtxtUseOptionsInternal()
14569 ctxt->options |= XML_PARSE_COMPACT; in xmlCtxtUseOptionsInternal()
14573 ctxt->options |= XML_PARSE_OLD10; in xmlCtxtUseOptionsInternal()
14577 ctxt->options |= XML_PARSE_NOBASEFIX; in xmlCtxtUseOptionsInternal()
14581 ctxt->options |= XML_PARSE_HUGE; in xmlCtxtUseOptionsInternal()
14585 ctxt->options |= XML_PARSE_OLDSAX; in xmlCtxtUseOptionsInternal()
14589 ctxt->options |= XML_PARSE_IGNORE_ENC; in xmlCtxtUseOptionsInternal()
14592 ctxt->linenumbers = 1; in xmlCtxtUseOptionsInternal()
14607 xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) in xmlCtxtUseOptions() argument
14609 return(xmlCtxtUseOptionsInternal(ctxt, options, NULL)); in xmlCtxtUseOptions()
14625 xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, in xmlDoRead() argument
14630 xmlCtxtUseOptionsInternal(ctxt, options, encoding); in xmlDoRead()
14636 xmlSwitchToEncoding(ctxt, hdlr); in xmlDoRead()
14638 if ((URL != NULL) && (ctxt->input != NULL) && in xmlDoRead()
14639 (ctxt->input->filename == NULL)) in xmlDoRead()
14640 ctxt->input->filename = (char *) xmlStrdup((const xmlChar *) URL); in xmlDoRead()
14641 xmlParseDocument(ctxt); in xmlDoRead()
14642 if ((ctxt->wellFormed) || ctxt->recovery) in xmlDoRead()
14643 ret = ctxt->myDoc; in xmlDoRead()
14646 if (ctxt->myDoc != NULL) { in xmlDoRead()
14647 xmlFreeDoc(ctxt->myDoc); in xmlDoRead()
14650 ctxt->myDoc = NULL; in xmlDoRead()
14652 xmlFreeParserCtxt(ctxt); in xmlDoRead()
14672 xmlParserCtxtPtr ctxt; in xmlReadDoc() local
14677 ctxt = xmlCreateDocParserCtxt(cur); in xmlReadDoc()
14678 if (ctxt == NULL) in xmlReadDoc()
14680 return (xmlDoRead(ctxt, URL, encoding, options, 0)); in xmlReadDoc()
14696 xmlParserCtxtPtr ctxt; in xmlReadFile() local
14698 ctxt = xmlCreateURLParserCtxt(filename, options); in xmlReadFile()
14699 if (ctxt == NULL) in xmlReadFile()
14701 return (xmlDoRead(ctxt, NULL, encoding, options, 0)); in xmlReadFile()
14719 xmlParserCtxtPtr ctxt; in xmlReadMemory() local
14721 ctxt = xmlCreateMemoryParserCtxt(buffer, size); in xmlReadMemory()
14722 if (ctxt == NULL) in xmlReadMemory()
14724 return (xmlDoRead(ctxt, URL, encoding, options, 0)); in xmlReadMemory()
14743 xmlParserCtxtPtr ctxt; in xmlReadFd() local
14754 ctxt = xmlNewParserCtxt(); in xmlReadFd()
14755 if (ctxt == NULL) { in xmlReadFd()
14759 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in xmlReadFd()
14762 xmlFreeParserCtxt(ctxt); in xmlReadFd()
14765 inputPush(ctxt, stream); in xmlReadFd()
14766 return (xmlDoRead(ctxt, URL, encoding, options, 0)); in xmlReadFd()
14786 xmlParserCtxtPtr ctxt; in xmlReadIO() local
14797 ctxt = xmlNewParserCtxt(); in xmlReadIO()
14798 if (ctxt == NULL) { in xmlReadIO()
14802 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in xmlReadIO()
14805 xmlFreeParserCtxt(ctxt); in xmlReadIO()
14808 inputPush(ctxt, stream); in xmlReadIO()
14809 return (xmlDoRead(ctxt, URL, encoding, options, 0)); in xmlReadIO()
14826 xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur, in xmlCtxtReadDoc() argument
14833 if (ctxt == NULL) in xmlCtxtReadDoc()
14836 xmlCtxtReset(ctxt); in xmlCtxtReadDoc()
14838 stream = xmlNewStringInputStream(ctxt, cur); in xmlCtxtReadDoc()
14842 inputPush(ctxt, stream); in xmlCtxtReadDoc()
14843 return (xmlDoRead(ctxt, URL, encoding, options, 1)); in xmlCtxtReadDoc()
14859 xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename, in xmlCtxtReadFile() argument
14866 if (ctxt == NULL) in xmlCtxtReadFile()
14869 xmlCtxtReset(ctxt); in xmlCtxtReadFile()
14871 stream = xmlLoadExternalEntity(filename, NULL, ctxt); in xmlCtxtReadFile()
14875 inputPush(ctxt, stream); in xmlCtxtReadFile()
14876 return (xmlDoRead(ctxt, NULL, encoding, options, 1)); in xmlCtxtReadFile()
14894 xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size, in xmlCtxtReadMemory() argument
14900 if (ctxt == NULL) in xmlCtxtReadMemory()
14905 xmlCtxtReset(ctxt); in xmlCtxtReadMemory()
14912 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in xmlCtxtReadMemory()
14918 inputPush(ctxt, stream); in xmlCtxtReadMemory()
14919 return (xmlDoRead(ctxt, URL, encoding, options, 1)); in xmlCtxtReadMemory()
14938 xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd, in xmlCtxtReadFd() argument
14946 if (ctxt == NULL) in xmlCtxtReadFd()
14949 xmlCtxtReset(ctxt); in xmlCtxtReadFd()
14956 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in xmlCtxtReadFd()
14961 inputPush(ctxt, stream); in xmlCtxtReadFd()
14962 return (xmlDoRead(ctxt, URL, encoding, options, 1)); in xmlCtxtReadFd()
14981 xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, in xmlCtxtReadIO() argument
14991 if (ctxt == NULL) in xmlCtxtReadIO()
14994 xmlCtxtReset(ctxt); in xmlCtxtReadIO()
15000 stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); in xmlCtxtReadIO()
15005 inputPush(ctxt, stream); in xmlCtxtReadIO()
15006 return (xmlDoRead(ctxt, URL, encoding, options, 1)); in xmlCtxtReadIO()