- Main Page
- Data Structures
- Files
- Examples

# parser.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2007 Doxological Ltd.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *     http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 #ifndef __FAXPP__PARSER_H
    00018 #define __FAXPP__PARSER_H
    00019
    00020 #include <stdio.h>
    00021
    00022 #include "error.h"
    00023 #include "transcode.h"
    00024 #include "event.h"
    00025
    00081
    00082 typedef struct FAXPP_ParserEnv_s FAXPP_Parser;
    00083
    00085 typedef enum {
    00088   NO_CHECKS_PARSE_MODE,
    00091   WELL_FORMED_PARSE_MODE
    00092 } FAXPP_ParseMode;
    00093
    00095 typedef enum {
    00096   EXTERNAL_PARSED_ENTITY    = 0,
    00097   EXTERNAL_SUBSET_ENTITY    = 1,
    00098   EXTERNAL_IN_MARKUP_ENTITY = 2
    00099 } FAXPP_EntityType;
    00100
    00114 typedef unsigned int (*FAXPP_ReadCallback)(void *userData, void *buffer, unsigned int length);
    00115
    00135 typedef FAXPP_Error (*FAXPP_ExternalEntityCallback)(void *userData, FAXPP_Parser *parser, FAXPP_EntityType type,
    00136                                                     const FAXPP_Text *base_uri, const FAXPP_Text *system_id, const FAXPP_Text *public_id);
    00137
    00148 FAXPP_Parser *FAXPP_create_parser(FAXPP_ParseMode mode, FAXPP_Transcoder encode);
    00149
    00157 void FAXPP_free_parser(FAXPP_Parser *parser);
    00158
    00175 void FAXPP_set_null_terminate(FAXPP_Parser *parser, unsigned int boolean);
    00176
    00197 void FAXPP_set_normalize_attrs(FAXPP_Parser *parser, unsigned int boolean);
    00198
    00209 void FAXPP_set_encode(FAXPP_Parser *parser, FAXPP_Transcoder encode);
    00210
    00219 FAXPP_DecodeFunction FAXPP_get_decode(const FAXPP_Parser *parser);
    00220
    00236 void FAXPP_set_decode(FAXPP_Parser *parser, FAXPP_DecodeFunction decode);
    00237
    00250 const FAXPP_Text *FAXPP_get_base_uri(const FAXPP_Parser *parser);
    00251
    00269 FAXPP_Error FAXPP_set_base_uri(FAXPP_Parser *parser, const FAXPP_Text *base_uri);
    00270
    00286 FAXPP_Error FAXPP_set_base_uri_str(FAXPP_Parser *parser, const char *base_uri);
    00287
    00298 void FAXPP_set_external_entity_callback(FAXPP_Parser *parser, FAXPP_ExternalEntityCallback callback, void *userData);
    00299
    00320 FAXPP_Error FAXPP_init_parse(FAXPP_Parser *parser, void *buffer, unsigned int length, unsigned int done);
    00321
    00339 FAXPP_Error FAXPP_init_parse_file(FAXPP_Parser *parser, FILE *file);
    00340
    00356 FAXPP_Error FAXPP_init_parse_callback(FAXPP_Parser *parser, FAXPP_ReadCallback callback, void *userData);
    00357
    00382 FAXPP_Error FAXPP_parse_external_entity(FAXPP_Parser *parser, FAXPP_EntityType type, void *buffer, unsigned int length, unsigned int done);
    00383
    00405 FAXPP_Error FAXPP_parse_external_entity_file(FAXPP_Parser *parser, FAXPP_EntityType type, FILE *file);
    00406
    00426 FAXPP_Error FAXPP_parse_external_entity_callback(FAXPP_Parser *parser, FAXPP_EntityType type, FAXPP_ReadCallback callback, void *userData);
    00427
    00445 FAXPP_Error FAXPP_release_buffer(FAXPP_Parser *parser, void **buffer_position);
    00446
    00462 FAXPP_Error FAXPP_continue_parse(FAXPP_Parser *parser, void *buffer,
    00463                                  unsigned int length, unsigned int done);
    00464
    00475 FAXPP_Error FAXPP_next_event(FAXPP_Parser *parser);
    00476
    00485 const FAXPP_Event *FAXPP_get_current_event(const FAXPP_Parser *parser);
    00486
    00503 FAXPP_Error FAXPP_lookup_namespace_uri(const FAXPP_Parser *parser, const FAXPP_Text *prefix, FAXPP_Text *uri);
    00504
    00513 unsigned int FAXPP_get_nesting_level(const FAXPP_Parser *parser);
    00514
    00523 unsigned int FAXPP_get_error_line(const FAXPP_Parser *parser);
    00524
    00533 unsigned int FAXPP_get_error_column(const FAXPP_Parser *parser);
    00534
    00546 #endif