Lines Matching refs:parser
36 static XML_Parser parser;
42 parser = XML_ParserCreate(NULL);
43 if (parser == NULL)
44 fail("Parser not created.");
50 if (parser != NULL)
51 XML_ParserFree(parser);
54 /* Generate a failure using the parser state to create an error message;
55 this should be used when the parser reports an error we weren't
59 _xml_failure(XML_Parser parser, const char *file, int line)
62 enum XML_Error err = XML_GetErrorCode(parser);
68 XML_GetCurrentLineNumber(parser),
69 XML_GetCurrentColumnNumber(parser),
75 _XML_Parse_SINGLE_BYTES(XML_Parser parser, const char *s, int len, int isFinal)
81 return XML_Parse(parser, s, len, isFinal);
87 res = XML_Parse(parser, &c, sizeof(char), innerIsFinal);
95 #define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__)
101 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK)
105 if (XML_GetErrorCode(parser) != errorCode)
106 _xml_failure(parser, file, lineno);
187 if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK)
188 fail("Parser did not report error on NUL-byte.");
189 if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)
190 xml_failure(parser);
200 "Parser did not report error on NUL-byte.");
209 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
210 xml_failure(parser);
218 if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
219 xml_failure(parser);
227 if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
228 xml_failure(parser);
257 XML_SetUserData(parser, &storage);
258 XML_SetCharacterDataHandler(parser, accumulate_characters);
259 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
260 _xml_failure(parser, file, line);
274 XML_SetUserData(parser, &storage);
275 XML_SetStartElementHandler(parser, accumulate_attribute);
276 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
277 _xml_failure(parser, file, line);
360 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) {
366 else if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)
367 xml_failure(parser);
368 /* Reset the parser since we use the same parser repeatedly. */
369 XML_ParserReset(parser, NULL);
449 if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
450 xml_failure(parser);
464 if ( _XML_Parse_SINGLE_BYTES(parser, text, first_chunk_bytes, XML_FALSE)
466 xml_failure(parser);
469 rc = _XML_Parse_SINGLE_BYTES(parser, text + first_chunk_bytes,
472 xml_failure(parser);
489 XML_ParserReset(parser, NULL);
503 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
504 xml_failure(parser);
505 lineno = XML_GetCurrentLineNumber(parser);
521 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
522 xml_failure(parser);
523 colno = XML_GetCurrentColumnNumber(parser);
543 parser),
544 XML_GetCurrentLineNumber(parser));
557 XML_GetCurrentColumnNumber(parser),
558 XML_GetCurrentLineNumber(parser));
588 XML_SetUserData(parser, &storage);
589 XML_SetStartElementHandler(parser, start_element_event_handler2);
590 XML_SetEndElementHandler(parser, end_element_event_handler2);
591 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
592 xml_failure(parser);
606 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
609 lineno = XML_GetCurrentLineNumber(parser);
626 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
629 colno = XML_GetCurrentColumnNumber(parser);
669 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
670 xml_failure(parser);
694 XML_SetUserData(parser, &storage);
695 XML_SetEndElementHandler(parser, end_element_event_handler);
696 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
697 xml_failure(parser);
807 XML_SetStartElementHandler(parser,
809 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
810 xml_failure(parser);
852 XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL);
853 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
854 xml_failure(parser);
860 external_entity_loader_set_encoding(XML_Parser parser,
874 extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
876 fail("Could not create external entity parser.");
881 xml_failure(parser);
895 XML_SetExternalEntityRefHandler(parser,
909 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
910 xml_failure(parser);
920 "Parser did not report undefined entity w/out a DTD.");
935 "Parser did not report undefined entity (standalone).");
940 external_entity_loader(XML_Parser parser,
946 char *text = (char *)XML_GetUserData(parser);
949 extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
951 fail("Could not create external entity parser.");
954 xml_failure(parser);
971 XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
972 XML_SetUserData(parser, foo_text);
973 XML_SetExternalEntityRefHandler(parser, external_entity_loader);
976 "Parser did not report undefined entity (external DTD).");
991 XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
992 XML_SetUserData(parser, foo_text);
993 XML_SetExternalEntityRefHandler(parser, external_entity_loader);
994 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
995 xml_failure(parser);
1009 "Parser did not report recursive entity reference.");
1026 XML_SetDefaultHandler(parser, accumulate_characters);
1027 XML_SetDoctypeDeclHandler(parser,
1030 XML_SetEntityDeclHandler(parser, dummy_entity_decl_handler);
1031 XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler);
1032 parser, dummy_element_decl_handler);
1033 XML_SetAttlistDeclHandler(parser, dummy_attlist_decl_handler);
1034 XML_SetProcessingInstructionHandler(parser, dummy_pi_handler);
1035 XML_SetCommentHandler(parser, dummy_comment_handler);
1053 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1054 xml_failure(parser);
1071 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1072 xml_failure(parser);
1106 XML_StopParser(parser, resumable);
1107 XML_SetCharacterDataHandler(parser, NULL);
1111 parser in doContext() 'for' loop. */
1117 handler must stop the parser and clear the character data
1122 XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler);
1124 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR)
1125 xml_failure(parser);
1126 if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED)
1127 xml_failure(parser);
1132 parser in doContext() 'for' loop. */
1138 handler must stop the parser and clear the character data
1143 XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler);
1145 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED)
1146 xml_failure(parser);
1147 if (XML_GetErrorCode(parser) != XML_ERROR_NONE)
1148 xml_failure(parser);
1159 XML_SetUserData(parser, &storage);
1160 XML_SetCharacterDataHandler(parser, accumulate_characters);
1162 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1163 xml_failure(parser);
1184 XML_SetUserData(parser, &storage);
1185 XML_SetCharacterDataHandler(parser, accumulate_characters);
1187 if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_ERROR)
1188 xml_failure(parser);
1230 parser, cases[i].text, strlen(cases[i].text), XML_TRUE);
1231 const enum XML_Error actualError = XML_GetErrorCode(parser);
1242 XML_ParserReset(parser, NULL);
1255 parser = XML_ParserCreateNS(NULL, ' ');
1256 if (parser == NULL)
1257 fail("Parser not created.");
1311 XML_SetReturnNSTriplet(parser, XML_TRUE);
1312 XML_SetUserData(parser, elemstr);
1313 XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker);
1314 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1315 xml_failure(parser);
1348 XML_SetUserData(parser, &storage);
1349 XML_SetElementHandler(parser,
1351 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1352 xml_failure(parser);
1394 XML_SetReturnNSTriplet(parser, XML_TRUE);
1425 XML_SetStartElementHandler(parser, start_element_fail);
1426 XML_SetStartNamespaceDeclHandler(parser, start_ns_clearing_start_element);
1427 XML_UseParserAsHandlerArg(parser);
1428 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1429 xml_failure(parser);
1435 external_entity_handler(XML_Parser parser,
1441 intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser);
1453 XML_SetUserData(parser, (void *) callno);
1454 p2 = XML_ExternalEntityParserCreate(parser, context, NULL);
1474 XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
1475 XML_SetExternalEntityRefHandler(parser, external_entity_handler);
1477 XML_SetStartElementHandler(parser, dummy_start_element);
1478 XML_SetUserData(parser, NULL);
1479 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1480 xml_failure(parser);
1545 XML_SetReturnNSTriplet(parser, XML_TRUE);
1546 XML_SetUserData(parser, elemstr);
1547 XML_SetEndElementHandler(parser, triplet_end_checker);
1548 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1549 xml_failure(parser);
1559 if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
1560 xml_failure(parser);