• Home
  • Raw
  • Download

Lines Matching refs:ctxt

106 xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)  in xmlErrMemory()  argument
108 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlErrMemory()
109 (ctxt->instate == XML_PARSER_EOF)) in xmlErrMemory()
111 if (ctxt != NULL) { in xmlErrMemory()
112 ctxt->errNo = XML_ERR_NO_MEMORY; in xmlErrMemory()
113 ctxt->instate = XML_PARSER_EOF; in xmlErrMemory()
114 ctxt->disableSAX = 1; in xmlErrMemory()
117 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, in xmlErrMemory()
122 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, in xmlErrMemory()
138 __xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr, in __xmlErrEncoding() argument
141 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in __xmlErrEncoding()
142 (ctxt->instate == XML_PARSER_EOF)) in __xmlErrEncoding()
144 if (ctxt != NULL) in __xmlErrEncoding()
145 ctxt->errNo = xmlerr; in __xmlErrEncoding()
147 ctxt, NULL, XML_FROM_PARSER, xmlerr, XML_ERR_FATAL, in __xmlErrEncoding()
150 if (ctxt != NULL) { in __xmlErrEncoding()
151 ctxt->wellFormed = 0; in __xmlErrEncoding()
152 if (ctxt->recovery == 0) in __xmlErrEncoding()
153 ctxt->disableSAX = 1; in __xmlErrEncoding()
166 xmlErrInternal(xmlParserCtxtPtr ctxt, const char *msg, const xmlChar * str) in xmlErrInternal() argument
168 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlErrInternal()
169 (ctxt->instate == XML_PARSER_EOF)) in xmlErrInternal()
171 if (ctxt != NULL) in xmlErrInternal()
172 ctxt->errNo = XML_ERR_INTERNAL_ERROR; in xmlErrInternal()
174 ctxt, NULL, XML_FROM_PARSER, XML_ERR_INTERNAL_ERROR, in xmlErrInternal()
177 if (ctxt != NULL) { in xmlErrInternal()
178 ctxt->wellFormed = 0; in xmlErrInternal()
179 if (ctxt->recovery == 0) in xmlErrInternal()
180 ctxt->disableSAX = 1; in xmlErrInternal()
194 xmlErrEncodingInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlErrEncodingInt() argument
197 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlErrEncodingInt()
198 (ctxt->instate == XML_PARSER_EOF)) in xmlErrEncodingInt()
200 if (ctxt != NULL) in xmlErrEncodingInt()
201 ctxt->errNo = error; in xmlErrEncodingInt()
203 ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, in xmlErrEncodingInt()
205 if (ctxt != NULL) { in xmlErrEncodingInt()
206 ctxt->wellFormed = 0; in xmlErrEncodingInt()
207 if (ctxt->recovery == 0) in xmlErrEncodingInt()
208 ctxt->disableSAX = 1; in xmlErrEncodingInt()
448 xmlNextChar(xmlParserCtxtPtr ctxt) in xmlNextChar() argument
450 if ((ctxt == NULL) || (ctxt->instate == XML_PARSER_EOF) || in xmlNextChar()
451 (ctxt->input == NULL)) in xmlNextChar()
454 if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { in xmlNextChar()
455 if ((*ctxt->input->cur == 0) && in xmlNextChar()
456 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0) && in xmlNextChar()
457 (ctxt->instate != XML_PARSER_COMMENT)) { in xmlNextChar()
464 xmlPopInput(ctxt); in xmlNextChar()
475 if (*(ctxt->input->cur) == '\n') { in xmlNextChar()
476 ctxt->input->line++; ctxt->input->col = 1; in xmlNextChar()
478 ctxt->input->col++; in xmlNextChar()
491 cur = ctxt->input->cur; in xmlNextChar()
498 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlNextChar()
499 cur = ctxt->input->cur; in xmlNextChar()
507 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlNextChar()
508 cur = ctxt->input->cur; in xmlNextChar()
514 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlNextChar()
515 cur = ctxt->input->cur; in xmlNextChar()
521 ctxt->input->cur += 4; in xmlNextChar()
528 ctxt->input->cur += 3; in xmlNextChar()
536 xmlErrEncodingInt(ctxt, XML_ERR_INVALID_CHAR, in xmlNextChar()
542 ctxt->input->cur += 2; in xmlNextChar()
545 ctxt->input->cur++; in xmlNextChar()
547 ctxt->nbChars++; in xmlNextChar()
548 if (*ctxt->input->cur == 0) in xmlNextChar()
549 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlNextChar()
558 if (*(ctxt->input->cur) == '\n') { in xmlNextChar()
559 ctxt->input->line++; ctxt->input->col = 1; in xmlNextChar()
561 ctxt->input->col++; in xmlNextChar()
562 ctxt->input->cur++; in xmlNextChar()
563 ctxt->nbChars++; in xmlNextChar()
564 if (*ctxt->input->cur == 0) in xmlNextChar()
565 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlNextChar()
567 if ((*ctxt->input->cur == '%') && (!ctxt->html)) in xmlNextChar()
568 xmlParserHandlePEReference(ctxt); in xmlNextChar()
569 if ((*ctxt->input->cur == 0) && in xmlNextChar()
570 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) in xmlNextChar()
571 xmlPopInput(ctxt); in xmlNextChar()
581 if ((ctxt == NULL) || (ctxt->input == NULL) || in xmlNextChar()
582 (ctxt->input->end - ctxt->input->cur < 4)) { in xmlNextChar()
583 __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, in xmlNextChar()
590 ctxt->input->cur[0], ctxt->input->cur[1], in xmlNextChar()
591 ctxt->input->cur[2], ctxt->input->cur[3]); in xmlNextChar()
592 __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, in xmlNextChar()
596 ctxt->charset = XML_CHAR_ENCODING_8859_1; in xmlNextChar()
597 ctxt->input->cur++; in xmlNextChar()
620 xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { in xmlCurrentChar() argument
621 if ((ctxt == NULL) || (len == NULL) || (ctxt->input == NULL)) return(0); in xmlCurrentChar()
622 if (ctxt->instate == XML_PARSER_EOF) in xmlCurrentChar()
625 if ((*ctxt->input->cur >= 0x20) && (*ctxt->input->cur <= 0x7F)) { in xmlCurrentChar()
627 return((int) *ctxt->input->cur); in xmlCurrentChar()
629 if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { in xmlCurrentChar()
641 const unsigned char *cur = ctxt->input->cur; in xmlCurrentChar()
650 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlCurrentChar()
651 cur = ctxt->input->cur; in xmlCurrentChar()
657 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlCurrentChar()
658 cur = ctxt->input->cur; in xmlCurrentChar()
664 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlCurrentChar()
665 cur = ctxt->input->cur; in xmlCurrentChar()
696 xmlErrEncodingInt(ctxt, XML_ERR_INVALID_CHAR, in xmlCurrentChar()
703 if (*ctxt->input->cur == 0) in xmlCurrentChar()
704 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); in xmlCurrentChar()
705 if ((*ctxt->input->cur == 0) && in xmlCurrentChar()
706 (ctxt->input->end > ctxt->input->cur)) { in xmlCurrentChar()
707 xmlErrEncodingInt(ctxt, XML_ERR_INVALID_CHAR, in xmlCurrentChar()
710 if (*ctxt->input->cur == 0xD) { in xmlCurrentChar()
711 if (ctxt->input->cur[1] == 0xA) { in xmlCurrentChar()
712 ctxt->nbChars++; in xmlCurrentChar()
713 ctxt->input->cur++; in xmlCurrentChar()
717 return((int) *ctxt->input->cur); in xmlCurrentChar()
726 if (*ctxt->input->cur == 0xD) { in xmlCurrentChar()
727 if (ctxt->input->cur[1] == 0xA) { in xmlCurrentChar()
728 ctxt->nbChars++; in xmlCurrentChar()
729 ctxt->input->cur++; in xmlCurrentChar()
733 return((int) *ctxt->input->cur); in xmlCurrentChar()
740 if (ctxt->input->end - ctxt->input->cur < 4) { in xmlCurrentChar()
756 ctxt->input->cur[0], ctxt->input->cur[1], in xmlCurrentChar()
757 ctxt->input->cur[2], ctxt->input->cur[3]); in xmlCurrentChar()
758 __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, in xmlCurrentChar()
762 ctxt->charset = XML_CHAR_ENCODING_8859_1; in xmlCurrentChar()
764 return((int) *ctxt->input->cur); in xmlCurrentChar()
780 xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len) in xmlStringCurrentChar() argument
783 if ((ctxt == NULL) || (ctxt->charset == XML_CHAR_ENCODING_UTF8)) { in xmlStringCurrentChar()
829 xmlErrEncodingInt(ctxt, XML_ERR_INVALID_CHAR, in xmlStringCurrentChar()
853 if ((ctxt == NULL) || (ctxt->input == NULL) || in xmlStringCurrentChar()
854 (ctxt->input->end - ctxt->input->cur < 4)) { in xmlStringCurrentChar()
869 ctxt->input->cur[0], ctxt->input->cur[1], in xmlStringCurrentChar()
870 ctxt->input->cur[2], ctxt->input->cur[3]); in xmlStringCurrentChar()
871 __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, in xmlStringCurrentChar()
954 xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt,
957 xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
970 xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc) in xmlSwitchEncoding() argument
975 if (ctxt == NULL) return(-1); in xmlSwitchEncoding()
978 __xmlErrEncoding(ctxt, XML_ERR_UNKNOWN_ENCODING, in xmlSwitchEncoding()
983 ctxt->charset = XML_CHAR_ENCODING_UTF8; in xmlSwitchEncoding()
987 ctxt->charset = XML_CHAR_ENCODING_UTF8; in xmlSwitchEncoding()
994 if ((ctxt->input != NULL) && in xmlSwitchEncoding()
995 (ctxt->input->cur[0] == 0xEF) && in xmlSwitchEncoding()
996 (ctxt->input->cur[1] == 0xBB) && in xmlSwitchEncoding()
997 (ctxt->input->cur[2] == 0xBF)) { in xmlSwitchEncoding()
998 ctxt->input->cur += 3; in xmlSwitchEncoding()
1011 if ((ctxt->input != NULL) && (ctxt->input->cur != NULL) && in xmlSwitchEncoding()
1012 (ctxt->input->cur[0] == 0xEF) && in xmlSwitchEncoding()
1013 (ctxt->input->cur[1] == 0xBB) && in xmlSwitchEncoding()
1014 (ctxt->input->cur[2] == 0xBF)) { in xmlSwitchEncoding()
1015 ctxt->input->cur += 3; in xmlSwitchEncoding()
1053 ctxt->charset = XML_CHAR_ENCODING_UTF8; in xmlSwitchEncoding()
1060 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1065 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1070 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1075 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1080 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1085 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1104 if ((ctxt->inputNr == 1) && in xmlSwitchEncoding()
1105 (ctxt->encoding == NULL) && in xmlSwitchEncoding()
1106 (ctxt->input != NULL) && in xmlSwitchEncoding()
1107 (ctxt->input->encoding != NULL)) { in xmlSwitchEncoding()
1108 ctxt->encoding = xmlStrdup(ctxt->input->encoding); in xmlSwitchEncoding()
1110 ctxt->charset = enc; in xmlSwitchEncoding()
1113 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1118 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1123 __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING, in xmlSwitchEncoding()
1133 ctxt->charset = XML_CHAR_ENCODING_UTF8; in xmlSwitchEncoding()
1134 return(xmlSwitchToEncodingInt(ctxt, handler, len)); in xmlSwitchEncoding()
1150 xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, in xmlSwitchInputEncodingInt() argument
1234 if (ctxt->html) { in xmlSwitchInputEncodingInt()
1254 xmlErrInternal(ctxt, in xmlSwitchInputEncodingInt()
1270 xmlErrInternal(ctxt, "switching encoding : no input\n", NULL); in xmlSwitchInputEncodingInt()
1288 xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, in xmlSwitchInputEncoding() argument
1290 return(xmlSwitchInputEncodingInt(ctxt, input, handler, -1)); in xmlSwitchInputEncoding()
1307 xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt, in xmlSwitchToEncodingInt() argument
1312 if (ctxt->input != NULL) { in xmlSwitchToEncodingInt()
1313 ret = xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, len); in xmlSwitchToEncodingInt()
1315 xmlErrInternal(ctxt, "xmlSwitchToEncoding : no input\n", in xmlSwitchToEncodingInt()
1322 ctxt->charset = XML_CHAR_ENCODING_UTF8; in xmlSwitchToEncodingInt()
1339 xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler) in xmlSwitchToEncoding() argument
1341 return (xmlSwitchToEncodingInt(ctxt, handler, -1)); in xmlSwitchToEncoding()
1379 xmlNewInputStream(xmlParserCtxtPtr ctxt) { in xmlNewInputStream() argument
1385 xmlErrMemory(ctxt, "couldn't allocate a new input stream\n"); in xmlNewInputStream()
1412 xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, in xmlNewIOInputStream() argument
1419 inputStream = xmlNewInputStream(ctxt); in xmlNewIOInputStream()
1429 xmlSwitchEncoding(ctxt, enc); in xmlNewIOInputStream()
1445 xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { in xmlNewEntityInputStream() argument
1449 xmlErrInternal(ctxt, "xmlNewEntityInputStream entity = NULL\n", in xmlNewEntityInputStream()
1459 xmlErrInternal(ctxt, "Cannot parse entity %s\n", in xmlNewEntityInputStream()
1465 (char *) entity->ExternalID, ctxt)); in xmlNewEntityInputStream()
1467 xmlErrInternal(ctxt, in xmlNewEntityInputStream()
1472 xmlErrInternal(ctxt, in xmlNewEntityInputStream()
1477 xmlErrInternal(ctxt, in xmlNewEntityInputStream()
1484 input = xmlNewInputStream(ctxt); in xmlNewEntityInputStream()
1506 xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer) { in xmlNewStringInputStream() argument
1510 xmlErrInternal(ctxt, "xmlNewStringInputStream string = NULL\n", in xmlNewStringInputStream()
1517 input = xmlNewInputStream(ctxt); in xmlNewStringInputStream()
1519 xmlErrMemory(ctxt, "couldn't allocate a new input stream\n"); in xmlNewStringInputStream()
1539 xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) { in xmlNewInputFromFile() argument
1548 if (ctxt == NULL) return(NULL); in xmlNewInputFromFile()
1552 __xmlLoaderErr(ctxt, in xmlNewInputFromFile()
1556 __xmlLoaderErr(ctxt, "failed to load external entity \"%s\"\n", in xmlNewInputFromFile()
1561 inputStream = xmlNewInputStream(ctxt); in xmlNewInputFromFile()
1566 inputStream = xmlCheckHTTPInput(ctxt, inputStream); in xmlNewInputFromFile()
1583 if ((ctxt->directory == NULL) && (directory != NULL)) in xmlNewInputFromFile()
1584 ctxt->directory = (char *) xmlStrdup((const xmlChar *) directory); in xmlNewInputFromFile()
1604 xmlInitParserCtxt(xmlParserCtxtPtr ctxt) in xmlInitParserCtxt() argument
1608 if(ctxt==NULL) { in xmlInitParserCtxt()
1615 if (ctxt->dict == NULL) in xmlInitParserCtxt()
1616 ctxt->dict = xmlDictCreate(); in xmlInitParserCtxt()
1617 if (ctxt->dict == NULL) { in xmlInitParserCtxt()
1621 if (ctxt->sax == NULL) in xmlInitParserCtxt()
1622 ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); in xmlInitParserCtxt()
1623 if (ctxt->sax == NULL) { in xmlInitParserCtxt()
1628 xmlSAXVersion(ctxt->sax, 2); in xmlInitParserCtxt()
1630 ctxt->maxatts = 0; in xmlInitParserCtxt()
1631 ctxt->atts = NULL; in xmlInitParserCtxt()
1633 if (ctxt->inputTab == NULL) { in xmlInitParserCtxt()
1634 ctxt->inputTab = (xmlParserInputPtr *) in xmlInitParserCtxt()
1636 ctxt->inputMax = 5; in xmlInitParserCtxt()
1638 if (ctxt->inputTab == NULL) { in xmlInitParserCtxt()
1640 ctxt->inputNr = 0; in xmlInitParserCtxt()
1641 ctxt->inputMax = 0; in xmlInitParserCtxt()
1642 ctxt->input = NULL; in xmlInitParserCtxt()
1645 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ in xmlInitParserCtxt()
1648 ctxt->inputNr = 0; in xmlInitParserCtxt()
1649 ctxt->input = NULL; in xmlInitParserCtxt()
1651 ctxt->version = NULL; in xmlInitParserCtxt()
1652 ctxt->encoding = NULL; in xmlInitParserCtxt()
1653 ctxt->standalone = -1; in xmlInitParserCtxt()
1654 ctxt->hasExternalSubset = 0; in xmlInitParserCtxt()
1655 ctxt->hasPErefs = 0; in xmlInitParserCtxt()
1656 ctxt->html = 0; in xmlInitParserCtxt()
1657 ctxt->external = 0; in xmlInitParserCtxt()
1658 ctxt->instate = XML_PARSER_START; in xmlInitParserCtxt()
1659 ctxt->token = 0; in xmlInitParserCtxt()
1660 ctxt->directory = NULL; in xmlInitParserCtxt()
1663 if (ctxt->nodeTab == NULL) { in xmlInitParserCtxt()
1664 ctxt->nodeTab = (xmlNodePtr *) xmlMalloc(10 * sizeof(xmlNodePtr)); in xmlInitParserCtxt()
1665 ctxt->nodeMax = 10; in xmlInitParserCtxt()
1667 if (ctxt->nodeTab == NULL) { in xmlInitParserCtxt()
1669 ctxt->nodeNr = 0; in xmlInitParserCtxt()
1670 ctxt->nodeMax = 0; in xmlInitParserCtxt()
1671 ctxt->node = NULL; in xmlInitParserCtxt()
1672 ctxt->inputNr = 0; in xmlInitParserCtxt()
1673 ctxt->inputMax = 0; in xmlInitParserCtxt()
1674 ctxt->input = NULL; in xmlInitParserCtxt()
1677 ctxt->nodeNr = 0; in xmlInitParserCtxt()
1678 ctxt->node = NULL; in xmlInitParserCtxt()
1681 if (ctxt->nameTab == NULL) { in xmlInitParserCtxt()
1682 ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *)); in xmlInitParserCtxt()
1683 ctxt->nameMax = 10; in xmlInitParserCtxt()
1685 if (ctxt->nameTab == NULL) { in xmlInitParserCtxt()
1687 ctxt->nodeNr = 0; in xmlInitParserCtxt()
1688 ctxt->nodeMax = 0; in xmlInitParserCtxt()
1689 ctxt->node = NULL; in xmlInitParserCtxt()
1690 ctxt->inputNr = 0; in xmlInitParserCtxt()
1691 ctxt->inputMax = 0; in xmlInitParserCtxt()
1692 ctxt->input = NULL; in xmlInitParserCtxt()
1693 ctxt->nameNr = 0; in xmlInitParserCtxt()
1694 ctxt->nameMax = 0; in xmlInitParserCtxt()
1695 ctxt->name = NULL; in xmlInitParserCtxt()
1698 ctxt->nameNr = 0; in xmlInitParserCtxt()
1699 ctxt->name = NULL; in xmlInitParserCtxt()
1702 if (ctxt->spaceTab == NULL) { in xmlInitParserCtxt()
1703 ctxt->spaceTab = (int *) xmlMalloc(10 * sizeof(int)); in xmlInitParserCtxt()
1704 ctxt->spaceMax = 10; in xmlInitParserCtxt()
1706 if (ctxt->spaceTab == NULL) { in xmlInitParserCtxt()
1708 ctxt->nodeNr = 0; in xmlInitParserCtxt()
1709 ctxt->nodeMax = 0; in xmlInitParserCtxt()
1710 ctxt->node = NULL; in xmlInitParserCtxt()
1711 ctxt->inputNr = 0; in xmlInitParserCtxt()
1712 ctxt->inputMax = 0; in xmlInitParserCtxt()
1713 ctxt->input = NULL; in xmlInitParserCtxt()
1714 ctxt->nameNr = 0; in xmlInitParserCtxt()
1715 ctxt->nameMax = 0; in xmlInitParserCtxt()
1716 ctxt->name = NULL; in xmlInitParserCtxt()
1717 ctxt->spaceNr = 0; in xmlInitParserCtxt()
1718 ctxt->spaceMax = 0; in xmlInitParserCtxt()
1719 ctxt->space = NULL; in xmlInitParserCtxt()
1722 ctxt->spaceNr = 1; in xmlInitParserCtxt()
1723 ctxt->spaceMax = 10; in xmlInitParserCtxt()
1724 ctxt->spaceTab[0] = -1; in xmlInitParserCtxt()
1725 ctxt->space = &ctxt->spaceTab[0]; in xmlInitParserCtxt()
1726 ctxt->userData = ctxt; in xmlInitParserCtxt()
1727 ctxt->myDoc = NULL; in xmlInitParserCtxt()
1728 ctxt->wellFormed = 1; in xmlInitParserCtxt()
1729 ctxt->nsWellFormed = 1; in xmlInitParserCtxt()
1730 ctxt->valid = 1; in xmlInitParserCtxt()
1731 ctxt->loadsubset = xmlLoadExtDtdDefaultValue; in xmlInitParserCtxt()
1732 ctxt->validate = xmlDoValidityCheckingDefaultValue; in xmlInitParserCtxt()
1733 ctxt->pedantic = xmlPedanticParserDefaultValue; in xmlInitParserCtxt()
1734 ctxt->linenumbers = xmlLineNumbersDefaultValue; in xmlInitParserCtxt()
1735 ctxt->keepBlanks = xmlKeepBlanksDefaultValue; in xmlInitParserCtxt()
1736 if (ctxt->keepBlanks == 0) in xmlInitParserCtxt()
1737 ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace; in xmlInitParserCtxt()
1739 ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0; in xmlInitParserCtxt()
1740 ctxt->vctxt.userData = ctxt; in xmlInitParserCtxt()
1741 ctxt->vctxt.error = xmlParserValidityError; in xmlInitParserCtxt()
1742 ctxt->vctxt.warning = xmlParserValidityWarning; in xmlInitParserCtxt()
1743 if (ctxt->validate) { in xmlInitParserCtxt()
1745 ctxt->vctxt.warning = NULL; in xmlInitParserCtxt()
1747 ctxt->vctxt.warning = xmlParserValidityWarning; in xmlInitParserCtxt()
1748 ctxt->vctxt.nodeMax = 0; in xmlInitParserCtxt()
1750 ctxt->replaceEntities = xmlSubstituteEntitiesDefaultValue; in xmlInitParserCtxt()
1751 ctxt->record_info = 0; in xmlInitParserCtxt()
1752 ctxt->nbChars = 0; in xmlInitParserCtxt()
1753 ctxt->checkIndex = 0; in xmlInitParserCtxt()
1754 ctxt->inSubset = 0; in xmlInitParserCtxt()
1755 ctxt->errNo = XML_ERR_OK; in xmlInitParserCtxt()
1756 ctxt->depth = 0; in xmlInitParserCtxt()
1757 ctxt->charset = XML_CHAR_ENCODING_UTF8; in xmlInitParserCtxt()
1758 ctxt->catalogs = NULL; in xmlInitParserCtxt()
1759 ctxt->nbentities = 0; in xmlInitParserCtxt()
1760 xmlInitNodeInfoSeq(&ctxt->node_seq); in xmlInitParserCtxt()
1773 xmlFreeParserCtxt(xmlParserCtxtPtr ctxt) in xmlFreeParserCtxt() argument
1777 if (ctxt == NULL) return; in xmlFreeParserCtxt()
1779 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ in xmlFreeParserCtxt()
1782 if (ctxt->spaceTab != NULL) xmlFree(ctxt->spaceTab); in xmlFreeParserCtxt()
1783 if (ctxt->nameTab != NULL) xmlFree((xmlChar * *)ctxt->nameTab); in xmlFreeParserCtxt()
1784 if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab); in xmlFreeParserCtxt()
1785 if (ctxt->nodeInfoTab != NULL) xmlFree(ctxt->nodeInfoTab); in xmlFreeParserCtxt()
1786 if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab); in xmlFreeParserCtxt()
1787 if (ctxt->version != NULL) xmlFree((char *) ctxt->version); in xmlFreeParserCtxt()
1788 if (ctxt->encoding != NULL) xmlFree((char *) ctxt->encoding); in xmlFreeParserCtxt()
1789 if (ctxt->extSubURI != NULL) xmlFree((char *) ctxt->extSubURI); in xmlFreeParserCtxt()
1790 if (ctxt->extSubSystem != NULL) xmlFree((char *) ctxt->extSubSystem); in xmlFreeParserCtxt()
1792 if ((ctxt->sax != NULL) && in xmlFreeParserCtxt()
1793 (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)) in xmlFreeParserCtxt()
1795 if (ctxt->sax != NULL) in xmlFreeParserCtxt()
1797 xmlFree(ctxt->sax); in xmlFreeParserCtxt()
1798 if (ctxt->directory != NULL) xmlFree((char *) ctxt->directory); in xmlFreeParserCtxt()
1799 if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab); in xmlFreeParserCtxt()
1800 if (ctxt->atts != NULL) xmlFree((xmlChar * *)ctxt->atts); in xmlFreeParserCtxt()
1801 if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); in xmlFreeParserCtxt()
1802 if (ctxt->nsTab != NULL) xmlFree((char *) ctxt->nsTab); in xmlFreeParserCtxt()
1803 if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab); in xmlFreeParserCtxt()
1804 if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs); in xmlFreeParserCtxt()
1805 if (ctxt->attsDefault != NULL) in xmlFreeParserCtxt()
1806 xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); in xmlFreeParserCtxt()
1807 if (ctxt->attsSpecial != NULL) in xmlFreeParserCtxt()
1808 xmlHashFree(ctxt->attsSpecial, NULL); in xmlFreeParserCtxt()
1809 if (ctxt->freeElems != NULL) { in xmlFreeParserCtxt()
1812 cur = ctxt->freeElems; in xmlFreeParserCtxt()
1819 if (ctxt->freeAttrs != NULL) { in xmlFreeParserCtxt()
1822 cur = ctxt->freeAttrs; in xmlFreeParserCtxt()
1832 if (ctxt->lastError.message != NULL) in xmlFreeParserCtxt()
1833 xmlFree(ctxt->lastError.message); in xmlFreeParserCtxt()
1834 if (ctxt->lastError.file != NULL) in xmlFreeParserCtxt()
1835 xmlFree(ctxt->lastError.file); in xmlFreeParserCtxt()
1836 if (ctxt->lastError.str1 != NULL) in xmlFreeParserCtxt()
1837 xmlFree(ctxt->lastError.str1); in xmlFreeParserCtxt()
1838 if (ctxt->lastError.str2 != NULL) in xmlFreeParserCtxt()
1839 xmlFree(ctxt->lastError.str2); in xmlFreeParserCtxt()
1840 if (ctxt->lastError.str3 != NULL) in xmlFreeParserCtxt()
1841 xmlFree(ctxt->lastError.str3); in xmlFreeParserCtxt()
1844 if (ctxt->catalogs != NULL) in xmlFreeParserCtxt()
1845 xmlCatalogFreeLocal(ctxt->catalogs); in xmlFreeParserCtxt()
1847 xmlFree(ctxt); in xmlFreeParserCtxt()
1861 xmlParserCtxtPtr ctxt; in xmlNewParserCtxt() local
1863 ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt)); in xmlNewParserCtxt()
1864 if (ctxt == NULL) { in xmlNewParserCtxt()
1868 memset(ctxt, 0, sizeof(xmlParserCtxt)); in xmlNewParserCtxt()
1869 if (xmlInitParserCtxt(ctxt) < 0) { in xmlNewParserCtxt()
1870 xmlFreeParserCtxt(ctxt); in xmlNewParserCtxt()
1873 return(ctxt); in xmlNewParserCtxt()
1890 xmlClearParserCtxt(xmlParserCtxtPtr ctxt) in xmlClearParserCtxt() argument
1892 if (ctxt==NULL) in xmlClearParserCtxt()
1894 xmlClearNodeInfoSeq(&ctxt->node_seq); in xmlClearParserCtxt()
1895 xmlCtxtReset(ctxt); in xmlClearParserCtxt()
2009 xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt, in xmlParserAddNodeInfo() argument
2014 if ((ctxt == NULL) || (info == NULL)) return; in xmlParserAddNodeInfo()
2017 pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, (xmlNodePtr) in xmlParserAddNodeInfo()
2020 if ((pos < ctxt->node_seq.length) && in xmlParserAddNodeInfo()
2021 (ctxt->node_seq.buffer != NULL) && in xmlParserAddNodeInfo()
2022 (ctxt->node_seq.buffer[pos].node == info->node)) { in xmlParserAddNodeInfo()
2023 ctxt->node_seq.buffer[pos] = *info; in xmlParserAddNodeInfo()
2028 if (ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) { in xmlParserAddNodeInfo()
2032 if (ctxt->node_seq.maximum == 0) in xmlParserAddNodeInfo()
2033 ctxt->node_seq.maximum = 2; in xmlParserAddNodeInfo()
2034 byte_size = (sizeof(*ctxt->node_seq.buffer) * in xmlParserAddNodeInfo()
2035 (2 * ctxt->node_seq.maximum)); in xmlParserAddNodeInfo()
2037 if (ctxt->node_seq.buffer == NULL) in xmlParserAddNodeInfo()
2041 (xmlParserNodeInfo *) xmlRealloc(ctxt->node_seq.buffer, in xmlParserAddNodeInfo()
2045 xmlErrMemory(ctxt, "failed to allocate buffer\n"); in xmlParserAddNodeInfo()
2048 ctxt->node_seq.buffer = tmp_buffer; in xmlParserAddNodeInfo()
2049 ctxt->node_seq.maximum *= 2; in xmlParserAddNodeInfo()
2053 if (pos != ctxt->node_seq.length) { in xmlParserAddNodeInfo()
2056 for (i = ctxt->node_seq.length; i > pos; i--) in xmlParserAddNodeInfo()
2057 ctxt->node_seq.buffer[i] = ctxt->node_seq.buffer[i - 1]; in xmlParserAddNodeInfo()
2061 ctxt->node_seq.buffer[pos] = *info; in xmlParserAddNodeInfo()
2062 ctxt->node_seq.length++; in xmlParserAddNodeInfo()