Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

WBXML Parser
[WBXML Library]


Files

file  wbxml_handlers.h
 WBXML Parser Handlers.

file  wbxml_parser.c
 WBXML Parser - Parse a WBXML document and call user defined Callbacks.

file  wbxml_parser.h
 WBXML Parser - Parse a WBXML document and call user defined Callbacks.


Compounds

struct  WBXMLContentHandler_s
 WBXMLContentHandler structure. More...


Typedefs

typedef void(* WBXMLStartDocumentHandler )(void *ctx, WB_LONG charset, const WBXMLLangEntry *lang)
 Start Document Handler.

typedef void(* WBXMLEndDocumentHandler )(void *ctx)
 End Document handler.

typedef void(* WBXMLStartElementHandler )(void *ctx, WBXMLTag *localName, WBXMLAttribute **atts, WB_BOOL empty)
 Start Element handler.

typedef void(* WBXMLEndElementHandler )(void *ctx, WBXMLTag *localName, WB_BOOL empty)
 End Element handler.

typedef void(* WBXMLCharactersHandler )(void *ctx, WB_UTINY *ch, WB_ULONG start, WB_ULONG length)
 Characters handler.

typedef void(* WBXMLProcessingInstructionHandler )(void *ctx, const WB_UTINY *target, WB_UTINY *data)
 Processing Instruction Handler.

typedef WBXMLContentHandler_s WBXMLContentHandler
 WBXMLContentHandler structure.

typedef WBXMLParser_s WBXMLParser

Functions

WBXMLParserwbxml_parser_create (void)
 Create a WBXML Parser.

void wbxml_parser_destroy (WBXMLParser *parser)
 Destroy a WBXML Parser.

WBXMLError wbxml_parser_parse (WBXMLParser *parser, WB_UTINY *wbxml, WB_ULONG wbxml_len)
 Parse a WBXML document, using User Defined callbacks Return WBXML_OK if no error, an error code otherwise.

void wbxml_parser_set_user_data (WBXMLParser *parser, void *user_data)
 Set User Data for a WBXML Parser.

void wbxml_parser_set_content_handler (WBXMLParser *parser, WBXMLContentHandler *content_handler)
 Set Content Handler for a WBXML Parser.

void wbxml_parser_set_main_table (WBXMLParser *parser, const WBXMLLangEntry *main_table)
 Set Main WBXML Languages Table.

unsigned char wbxml_parser_set_language (WBXMLParser *parser, WBXMLLanguage lang)
 Force to parse the Document of a given Language.

unsigned int wbxml_parser_get_wbxml_public_id (WBXMLParser *parser)
 Get WBXML Public ID.

const unsigned char * wbxml_parser_get_xml_public_id (WBXMLParser *parser)
 Get XML Public ID.

WBXMLVersion wbxml_parser_get_wbxml_version (WBXMLParser *parser)
 Get WBXML Version.

int wbxml_parser_get_current_byte_index (WBXMLParser *parser)
 Return current parsing position in WBXML.


Typedef Documentation

typedef void(* WBXMLCharactersHandler)(void *ctx, WB_UTINY *ch, WB_ULONG start, WB_ULONG length)
 

Characters handler.

Parameters:
ctx User data
ch The characters
start The start position in the array
length The number of characters to read from the array

Definition at line 84 of file wbxml_handlers.h.

typedef struct WBXMLContentHandler_s WBXMLContentHandler
 

WBXMLContentHandler structure.

typedef void(* WBXMLEndDocumentHandler)(void *ctx)
 

End Document handler.

Parameters:
ctx User data

Definition at line 58 of file wbxml_handlers.h.

typedef void(* WBXMLEndElementHandler)(void *ctx, WBXMLTag *localName, WB_BOOL empty)
 

End Element handler.

Parameters:
ctx User data
localName The local tag name
empty Set to TRUE if this is an empty element

Definition at line 75 of file wbxml_handlers.h.

typedef struct WBXMLParser_s WBXMLParser
 

Definition at line 46 of file wbxml_parser.h.

typedef void(* WBXMLProcessingInstructionHandler)(void *ctx, const WB_UTINY *target, WB_UTINY *data)
 

Processing Instruction Handler.

Parameters:
ctx User data
target The processing instruction target.
data The processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target

Definition at line 93 of file wbxml_handlers.h.

typedef void(* WBXMLStartDocumentHandler)(void *ctx, WB_LONG charset, const WBXMLLangEntry *lang)
 

Start Document Handler.

Parameters:
ctx User data
charset Charset (The MIBenum from IANA character-sets assignements. See "http://www.iana.org/assignments/character-sets")
lang Language Table for this Document (cf: wbxml_table.[h|c])

Definition at line 52 of file wbxml_handlers.h.

typedef void(* WBXMLStartElementHandler)(void *ctx, WBXMLTag *localName, WBXMLAttribute **atts, WB_BOOL empty)
 

Start Element handler.

Parameters:
ctx User data
localName The local tag name
atts The attributes attached to the element
empty Set to TRUE if this is an empty element

Definition at line 67 of file wbxml_handlers.h.


Function Documentation

WBXMLParser* wbxml_parser_create void   
 

Create a WBXML Parser.

Returns:
Return the newly created WBXMLParser, or NULL if not enough memory

Definition at line 176 of file wbxml_parser.c.

References WBXMLParser_s::attrCodePage, WBXMLParser_s::charset, WBXMLParser_s::content_hdl, WBXMLParser_s::current_tag, WBXMLParser_s::lang_forced, WBXMLParser_s::langTable, WBXMLParser_s::mainTable, NULL, WBXMLParser_s::pos, WBXMLParser_s::public_id, WBXMLParser_s::public_id_index, WBXMLParser_s::strstbl, WBXMLParser_s::tagCodePage, WBXMLParser_s::user_data, WBXMLParser_s::version, WBXMLParser_s::wbxml, WBXML_LANG_UNKNOWN, wbxml_malloc(), WBXML_PUBLIC_ID_UNKNOWN, wbxml_tables_get_main(), and WBXML_VERSION_UNKNOWN.

Referenced by wbxml_tree_from_wbxml().

void wbxml_parser_destroy WBXMLParser   parser
 

Destroy a WBXML Parser.

Parameters:
parser The WBXMLParser to destroy

Definition at line 210 of file wbxml_parser.c.

References NULL, WBXMLParser_s::strstbl, WBXMLParser_s::wbxml, wbxml_buffer_destroy(), and wbxml_free().

Referenced by wbxml_tree_from_wbxml().

int wbxml_parser_get_current_byte_index WBXMLParser   parser
 

Return current parsing position in WBXML.

Parameters:
parser The WBXML Parser
Returns:
The parsing position in WBXML

Definition at line 347 of file wbxml_parser.c.

References NULL, WBXMLParser_s::pos, and WB_LONG.

Referenced by wbxml_tree_from_wbxml().

unsigned int wbxml_parser_get_wbxml_public_id WBXMLParser   parser
 

Get WBXML Public ID.

Parameters:
parser The WBXML Parser
Returns:
The WBXML Public ID of current parsing document

Definition at line 320 of file wbxml_parser.c.

References WBXMLParser_s::langTable, NULL, WBXMLLangEntry_s::publicID, WB_ULONG, WBXML_PUBLIC_ID_UNKNOWN, and WBXMLPublicIDEntry_s::wbxmlPublicID.

WBXMLVersion wbxml_parser_get_wbxml_version WBXMLParser   parser
 

Get WBXML Version.

Parameters:
parser The WBXML Parser
Returns:
The WBXML Version of current parsing document

Definition at line 338 of file wbxml_parser.c.

References NULL, WBXMLParser_s::version, WBXML_VERSION_UNKNOWN, and WBXMLVersion.

const unsigned char* wbxml_parser_get_xml_public_id WBXMLParser   parser
 

Get XML Public ID.

Parameters:
parser The WBXML Parser
Returns:
The XML Public ID of current parsing document, or NULL if not found

Definition at line 329 of file wbxml_parser.c.

References WBXMLParser_s::langTable, NULL, WBXMLLangEntry_s::publicID, WB_UTINY, and WBXMLPublicIDEntry_s::xmlPublicID.

WBXMLError wbxml_parser_parse WBXMLParser   parser,
WB_UTINY *    wbxml,
WB_ULONG    wbxml_len
 

Parse a WBXML document, using User Defined callbacks Return WBXML_OK if no error, an error code otherwise.

Parameters:
parser The WBXML Parser to use for parsing
wbxml The WBXML document to parse
wbxml_len The WBXML document length

Referenced by wbxml_tree_from_wbxml().

void wbxml_parser_set_content_handler WBXMLParser   parser,
WBXMLContentHandler   content_handler
 

Set Content Handler for a WBXML Parser.

Parameters:
parser The WBXML Parser
content_handler The Content Handler structure

Definition at line 295 of file wbxml_parser.c.

References WBXMLParser_s::content_hdl, and NULL.

Referenced by wbxml_tree_from_wbxml().

unsigned char wbxml_parser_set_language WBXMLParser   parser,
WBXMLLanguage    lang
 

Force to parse the Document of a given Language.

Parameters:
parser The WBXML Parser
lang The Language
Returns:
TRUE if Language is set, FALSE otherwise
Note:
This permits to force the WBXML Parser to parse a WBXML Document of a given LanguageD. If this fonction is used, the internal Public ID of the WBXML Document is ignored. It is sometimes needed for documents that don't have any WBXML Public ID.

Definition at line 309 of file wbxml_parser.c.

References FALSE, WBXMLParser_s::lang_forced, NULL, TRUE, WB_BOOL, and WBXMLLanguage.

Referenced by wbxml_tree_from_wbxml().

void wbxml_parser_set_main_table WBXMLParser   parser,
const WBXMLLangEntry   main_table
 

Set Main WBXML Languages Table.

Parameters:
parser The WBXML Parser
main_table The Main WBXML Languages Table to set

Definition at line 302 of file wbxml_parser.c.

References WBXMLParser_s::mainTable, and NULL.

void wbxml_parser_set_user_data WBXMLParser   parser,
void *    user_data
 

Set User Data for a WBXML Parser.

Parameters:
parser The WBXML Parser
user_data User data (returned as a parameter in every Content Handler callbacks)

Definition at line 288 of file wbxml_parser.c.

References NULL, and WBXMLParser_s::user_data.

Referenced by wbxml_tree_from_wbxml().


Generated on Mon Nov 24 20:09:48 2003 for WBXML Library by doxygen1.3-rc1