Lines Matching refs:parser
7 |_| XML parser
127 /* Generate a failure using the parser state to create an error message;
128 this should be used when the parser reports an error we weren't
132 _xml_failure(XML_Parser parser, const char *file, int line) {
134 enum XML_Error err = XML_GetErrorCode(parser);
138 err, XML_ErrorString(err), XML_GetCurrentLineNumber(parser),
139 XML_GetCurrentColumnNumber(parser), file, line);
144 _XML_Parse_SINGLE_BYTES(XML_Parser parser, const char *s, int len,
150 return XML_Parse(parser, s, len, isFinal);
156 res = XML_Parse(parser, &c, sizeof(char), innerIsFinal);
164 #define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__)
268 * we cannot pass the parser as the userData because this is used
412 external_entity_optioner(XML_Parser parser, const XML_Char *context,
415 ExtOption *options = (ExtOption *)XML_GetUserData(parser);
423 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
760 /* Reset the parser since we use the same parser repeatedly. */
1490 external_entity_loader(XML_Parser parser, const XML_Char *context,
1493 ExtTest *test_data = (ExtTest *)XML_GetUserData(parser);
1499 extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
1501 fail("Could not create external entity parser.");
1579 external_entity_faulter(XML_Parser parser, const XML_Char *context,
1583 ExtFaults *fault = (ExtFaults *)XML_GetUserData(parser);
1588 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
1590 fail("Could not create external entity parser");
1622 /* Try handing an invalid encoding to an external entity parser */
1994 parser in doContext() 'for' loop. */
1999 handler must stop the parser and clear the character data
2015 parser in doContext() 'for' loop. */
2020 handler must stop the parser and clear the character data
2051 /* Check that aborting an aborted parser is faulted */
2053 fail("Aborting aborted parser not faulted");
2057 /* Check that aborting a suspended parser works */
2061 /* Check that suspending a suspended parser works */
2063 fail("Suspending suspended parser not faulted");
2078 fail("Failed to double-stop parser");
2086 fail("Failed to double-suspend parser");
2094 fail("Failed to suspend-abort parser");
2478 /* Test stopping the parser in cdata handler */
2488 /* Test suspending the parser in cdata handler */
2851 external_entity_null_loader(XML_Parser parser, const XML_Char *context,
2854 UNUSED_P(parser);
3078 /* Test resetting a subordinate parser does exactly nothing */
3080 external_entity_resetter(XML_Parser parser, const XML_Char *context,
3090 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3092 fail("Could not create external entity parser");
3100 xml_failure(parser);
3137 /* Test suspending a subordinate parser */
3146 fail("Attempting to suspend a subordinate parser not faulted");
3148 fail("Suspending subordinate parser get wrong code");
3154 external_entity_suspender(XML_Parser parser, const XML_Char *context,
3163 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3165 fail("Could not create external entity parser");
3190 /* Test suspending a subordinate parser from an XML declaration */
3205 external_entity_suspend_xmldecl(XML_Parser parser, const XML_Char *context,
3216 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3218 fail("Could not create external entity parser");
3275 external_entity_suspending_faulter(XML_Parser parser, const XML_Char *context,
3280 ExtFaults *fault = (ExtFaults *)XML_GetUserData(parser);
3287 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3289 fail("Could not create external entity parser");
3405 external_entity_cr_catcher(XML_Parser parser, const XML_Char *context,
3414 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3416 fail("Could not create external entity parser");
3426 external_entity_bad_cr_catcher(XML_Parser parser, const XML_Char *context,
3435 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3437 fail("Could not create external entity parser");
3531 external_entity_rsqb_catcher(XML_Parser parser, const XML_Char *context,
3540 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3542 fail("Could not create external entity parser");
3574 external_entity_good_cdata_ascii(XML_Parser parser, const XML_Char *context,
3586 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3588 fail("Could not create external entity parser");
3652 fail("User data (parser) not correctly set");
3653 /* Check that the user data in the parser is appropriate */
3655 fail("User data in parser not correctly set");
3660 external_entity_param_checker(XML_Parser parser, const XML_Char *context,
3663 const char *text = "<!-- Subordinate parser -->\n"
3670 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
3672 fail("Could not create external entity parser");
3676 xml_failure(parser);
3679 handler_data = parser;
3689 const char *epilog = "<!-- Back to primary parser -->\n"
3724 * the parser as the first argument.
3727 * 'parser' for once, since the first time the handler is called it
3729 * global 'parser' variable to create our external entity parser from,
3746 /* Here we use the global 'parser' variable */
3749 fail("Could not create external entity parser");
3765 /* Set a handler arg that is not NULL and not parser (which is
3834 * of the pool allocation code in the parser that otherwise does not
3929 XML_Parser parser = XML_ParserCreate(NULL);
3930 assert(parser != NULL);
3937 if (XML_Parse(parser, text, (int)strlen(text), XML_FALSE /* isFinal */)
3939 xml_failure(parser);
3942 if (XML_GetBuffer(parser, INT_MAX - expectedKeepValue + 1) != NULL)
3945 XML_ParserFree(parser);
4076 * mark. "<el/>" is not one of them, so the parser should raise an
4080 external_entity_param(XML_Parser parser, const XML_Char *context,
4096 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4098 fail("Could not create external entity parser");
4148 external_entity_load_ignore(XML_Parser parser, const XML_Char *context,
4157 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4159 fail("Could not create external entity parser");
4162 xml_failure(parser);
4193 external_entity_load_ignore_utf16(XML_Parser parser, const XML_Char *context,
4207 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4209 fail("Could not create external entity parser");
4212 xml_failure(parser);
4246 external_entity_load_ignore_utf16_be(XML_Parser parser, const XML_Char *context,
4260 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4262 fail("Could not create external entity parser");
4265 xml_failure(parser);
4327 external_entity_valuer(XML_Parser parser, const XML_Char *context,
4340 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4342 fail("Could not create external entity parser");
4348 ExtFaults *fault = (ExtFaults *)XML_GetUserData(parser);
4417 external_entity_not_standalone(XML_Parser parser, const XML_Char *context,
4430 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4432 fail("Could not create external entity parser");
4465 external_entity_value_aborter(XML_Parser parser, const XML_Char *context,
4479 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4481 fail("Could not create external entity parser");
4561 /* Test that the parser stops processing the DTD after an unresolved
4655 external_entity_public(XML_Parser parser, const XML_Char *context,
4658 const char *text1 = (const char *)XML_GetUserData(parser);
4665 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4673 fail("Unexpected parameters to external entity parser");
4743 external_entity_devaluer(XML_Parser parser, const XML_Char *context,
4750 intptr_t clear_handler = (intptr_t)XML_GetUserData(parser);
4758 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
4760 fail("Could note create external entity parser");
5046 /* Test attempting to use parser after an error is faulted */
5091 * standalone internal DTD. Covers a corner case in the parser.
5134 external_entity_oneshot_loader(XML_Parser parser, const XML_Char *context,
5137 ExtHdlrData *test_data = (ExtHdlrData *)XML_GetUserData(parser);
5143 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
5145 fail("Could not create external entity parser.");
5146 /* Use the requested entity parser for further externals */
5723 /* Test an external entity parser set to use latin-1 detects UTF-16
5737 external_entity_loader2(XML_Parser parser, const XML_Char *context,
5740 ExtTest2 *test_data = (ExtTest2 *)XML_GetUserData(parser);
5746 extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
5748 fail("Coulr not create external entity parser");
5980 external_entity_faulter2(XML_Parser parser, const XML_Char *context,
5983 ExtFaults2 *test_data = (ExtFaults2 *)XML_GetUserData(parser);
5989 extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
5991 fail("Could not create external entity parser");
6143 XML_Parser parser = XML_ParserCreate(NULL);
6146 = XML_Parse(parser, doc, (int)strlen(doc), /*isFinal=*/XML_FALSE);
6153 && (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)) {
6162 (unsigned)strlen(cases[i].tagName), XML_GetErrorCode(parser));
6166 XML_ParserFree(parser);
6864 external_entity_handler(XML_Parser parser, const XML_Char *context,
6867 intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser);
6882 XML_SetUserData(parser, (void *)callno);
6883 p2 = XML_ExternalEntityParserCreate(parser, context, NULL);
7419 XML_Parser parser = XML_ParserCreateNS(NULL, '\n');
7420 XML_SetElementHandler(parser, dummy_start_element, dummy_end_element);
7421 if (XML_Parse(parser, cases[i].doc, (int)strlen(cases[i].doc),
7426 XML_ParserFree(parser);
7463 /* Test that a failure to allocate the parser structure fails gracefully */
7483 /* Test memory allocation failures for a parser with an encoding */
7503 /* Test that freeing a NULL parser doesn't cause an explosion.
7651 /* Test parser created for UTF-16LE is successful */
7676 XML_Parser parser;
7696 XML_StopParser(mydata->parser, 0);
7701 XML_Parser parser;
7706 parser = XML_ParserCreate(NULL);
7707 XML_SetElementHandler(parser, start_element_issue_240, end_element_issue_240);
7709 mydata->parser = parser;
7711 XML_SetUserData(parser, mydata);
7713 result = XML_Parse(parser, doc1, (int)strlen(doc1), 1);
7714 XML_ParserFree(parser);
7717 fail("Stopping the parser did not work as expected");
7722 XML_Parser parser;
7727 parser = XML_ParserCreate(NULL);
7728 XML_SetElementHandler(parser, start_element_issue_240, end_element_issue_240);
7730 mydata->parser = parser;
7732 XML_SetUserData(parser, mydata);
7734 result = XML_Parse(parser, doc2, (int)strlen(doc2), 1);
7735 XML_ParserFree(parser);
7738 fail("Stopping the parser did not work as expected");
7766 XML_Parser parser;
7773 parser = XML_ParserCreate(NULL);
7775 = XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
7779 parseResult = XML_Parse(parser, input, (int)strlen(input), 0);
7781 parseResult = XML_Parse(parser, "", 0, 1);
7787 if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)
7790 lineNumber = XML_GetCurrentLineNumber(parser);
7794 columnNumber = XML_GetCurrentColumnNumber(parser);
7798 XML_ParserFree(parser);
7807 /* Ensure the parser creation will go through */
7833 /* Resetting the parser is insufficient, because some memory
7834 * allocations are cached within the parser. Instead we use
7836 * right sort of parser back in our hands.
8054 external_entity_duff_loader(XML_Parser parser, const XML_Char *context,
8067 new_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
8074 fail("External parser creation ignored failing allocator");
8076 fail("Extern parser not created with max allocation count");
8085 /* Test that external parser creation running out of memory is
8099 fail("External parser allocator returned success incorrectly");
8104 /* More external parser memory allocation testing */
8133 external_entity_dbl_handler(XML_Parser parser, const XML_Char *context,
8136 intptr_t callno = (intptr_t)XML_GetUserData(parser);
8151 new_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
8153 fail("Unable to allocate first external parser");
8157 XML_SetUserData(parser, (void *)(intptr_t)(10000 - allocation_count));
8164 new_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
8169 fail("Second external parser unexpectedly created");
8173 fail("Second external parser not created");
8210 external_entity_dbl_handler_2(XML_Parser parser, const XML_Char *context,
8213 intptr_t callno = (intptr_t)XML_GetUserData(parser);
8226 XML_SetUserData(parser, (void *)(intptr_t)1);
8227 new_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
8235 new_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
8281 external_entity_alloc_set_encoding(XML_Parser parser, const XML_Char *context,
8294 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
8509 external_entity_reallocator(XML_Parser parser, const XML_Char *context,
8520 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
8522 fail("Could not create external entity parser");
8524 reallocation_count = (intptr_t)XML_GetUserData(parser);
8816 external_entity_alloc(XML_Parser parser, const XML_Char *context,
8819 const char *text = (const char *)XML_GetUserData(parser);
8826 ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL);
10025 /* Ensure the parser creation will go through */
10055 /* Resetting the parser is insufficient, because some memory
10056 * allocations are cached within the parser. Instead we use
10058 * right sort of parser back in our hands.
10097 /* Check that resuming an unsuspended parser is faulted */
10099 fail("Resuming unsuspended parser not faulted");
10103 /* Get the parser into suspended state */
10464 * parser, but instead adds them to an internal free list to be reused
11205 * to an external entity parser, the parsers handle reallocation
11478 accounting_external_entity_ref_handler(XML_Parser parser,
11488 = (const struct AccountingTestCase *)XML_GetUserData(parser);
11500 XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
11715 XML_Parser parser = XML_ParserCreate(NULL);
11716 XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
11718 XML_SetExternalEntityRefHandler(parser,
11720 XML_SetUserData(parser, (void *)&cases[u]);
11728 = xmlParseFunction(parser, cases[u].primaryText,
11731 _xml_failure(parser, __FILE__, __LINE__);
11735 = testingAccountingGetCountBytesDirect(parser);
11737 = testingAccountingGetCountBytesIndirect(parser);
11739 XML_ParserFree(parser);
11777 fail("Call with NULL parser is NOT supposed to succeed");
11781 fail("Call with non-root parser is NOT supposed to succeed");
11812 fail("Call with NULL parser is NOT supposed to succeed");
11816 fail("Call with non-root parser is NOT supposed to succeed");
11822 fail("Call with non-NULL parentless parser is supposed to succeed");