Lines Matching refs:parser
7 |_| XML parser
62 /* Test that a failure to allocate the parser structure fails gracefully */
82 /* Test memory allocation failures for a parser with an encoding */
102 /* Test that freeing a NULL parser doesn't cause an explosion.
264 /* Test parser created for UTF-16LE is successful */
289 XML_Parser parser;
294 parser = XML_ParserCreate(NULL);
295 XML_SetElementHandler(parser, start_element_issue_240, end_element_issue_240);
297 mydata->parser = parser;
299 XML_SetUserData(parser, mydata);
301 result = _XML_Parse_SINGLE_BYTES(parser, doc1, (int)strlen(doc1), 1);
302 XML_ParserFree(parser);
305 fail("Stopping the parser did not work as expected");
310 XML_Parser parser;
315 parser = XML_ParserCreate(NULL);
316 XML_SetElementHandler(parser, start_element_issue_240, end_element_issue_240);
318 mydata->parser = parser;
320 XML_SetUserData(parser, mydata);
322 result = _XML_Parse_SINGLE_BYTES(parser, doc2, (int)strlen(doc2), 1);
323 XML_ParserFree(parser);
326 fail("Stopping the parser did not work as expected");
356 XML_Parser parser;
363 parser = XML_ParserCreate(NULL);
365 = XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
369 parseResult = _XML_Parse_SINGLE_BYTES(parser, input, (int)strlen(input), 0);
371 parseResult = _XML_Parse_SINGLE_BYTES(parser, "", 0, 1);
377 if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)
380 lineNumber = XML_GetCurrentLineNumber(parser);
384 columnNumber = XML_GetCurrentColumnNumber(parser);
388 XML_ParserFree(parser);
396 XML_Parser parser = XML_ParserCreateNS(NULL, XCS('\n'));
398 if (_XML_Parse_SINGLE_BYTES(parser, text, (int)strlen(text), XML_TRUE)
401 if (XML_GetErrorCode(parser) != XML_ERROR_TAG_MISMATCH)
404 XML_ParserReset(parser, NULL);
406 if (_XML_Parse_SINGLE_BYTES(parser, text, (int)strlen(text), XML_TRUE)
409 if (XML_GetErrorCode(parser) != XML_ERROR_TAG_MISMATCH)
412 XML_ParserFree(parser);
422 XML_Parser parser = XML_ParserCreate(NULL);
423 XML_Parser ext_parser = XML_ExternalEntityParserCreate(parser, NULL, NULL);
430 XML_ParserFree(parser);
445 XML_Parser parser = XML_ParserCreate(NULL);
446 XML_SetUserData(parser, &storage);
447 XML_SetStartElementHandler(parser, accumulate_start_element);
448 XML_SetExternalEntityRefHandler(parser,
450 XML_SetEntityDeclHandler(parser, accumulate_entity_decl);
451 XML_SetCharacterDataHandler(parser, accumulate_characters);
453 if (_XML_Parse_SINGLE_BYTES(parser, doc, (int)strlen(doc), XML_TRUE)
455 xml_failure(parser);
458 XML_ParserFree(parser);
483 XML_Parser parser = (XML_Parser)userData;
484 XML_StopParser(parser, XML_TRUE);
491 XML_Parser parser = XML_ParserCreate(NULL);
492 assert_true(parser != NULL);
493 XML_SetUserData(parser, parser);
494 XML_SetCharacterDataHandler(parser, resumable_stopping_character_handler);
495 _XML_Parse_SINGLE_BYTES(parser, data, (int)strlen(data), XML_FALSE);
496 XML_ParserFree(parser);
501 XML_Parser parser = XML_ParserCreate(NULL);
502 XML_GetBuffer(parser, 1);
503 XML_StopParser(parser, /*resumable=*/XML_TRUE);
504 XML_ResumeParser(parser); // could crash here, previously
505 XML_ParserFree(parser);
513 XML_Parser parser = XML_ParserCreate(NULL);
514 assert_true(XML_GetErrorCode(parser) == XML_ERROR_NONE);
515 assert_true(XML_StopParser(parser, resumable) == XML_STATUS_ERROR);
516 assert_true(XML_GetErrorCode(parser) == XML_ERROR_NOT_STARTED);
517 XML_ParserFree(parser);