#include <event_parser.h>
Public Types | |
typedef std::map< std::string, std::string > | attrs_type |
a type for holding XML node attributes | |
typedef std::size_t | size_type |
size type | |
Public Member Functions | |
event_parser (void) | |
xml::event_parser class constructor. | |
virtual | ~event_parser (void) |
xml::event_parser class destructor. | |
bool | parse_file (const char *filename) |
Call this member function to parse the given file. | |
bool | parse_stream (std::istream &stream) |
Parse what ever data that can be read from the given stream. | |
bool | parse_chunk (const char *chunk, size_type length) |
Call this function to parse a chunk of xml data. | |
bool | parse_finish (void) |
Finish parsing chunked data. | |
const std::string & | get_error_message (void) const |
If there was an error parsing the XML data, (indicated by one of the parsing functions returning false), you can call this function to get a message describing the error. | |
Protected Member Functions | |
virtual bool | start_element (const std::string &name, const attrs_type &attrs)=0 |
Override this member function to receive the start_element message. | |
virtual bool | end_element (const std::string &name)=0 |
Override this member function to receive the end_element message. | |
virtual bool | text (const std::string &contents)=0 |
Override this member function to receive the text message. | |
virtual bool | cdata (const std::string &contents) |
Override this member function to receive the cdata mesage. | |
virtual bool | processing_instruction (const std::string &target, const std::string &data) |
Override this member function to receive the procesing_instruction message. | |
virtual bool | comment (const std::string &contents) |
Override this member function to receive the comment message. | |
virtual bool | warning (const std::string &message) |
Override this memeber function to receive parser warnings. | |
void | set_error_message (const char *message) |
Set the error message that will be returned from the get_error_message() member function. |
In order to use this class you derive a sub-class from it and override the protected virtual functions.
|
a type for holding XML node attributes
|
|
size type
|
|
xml::event_parser class constructor.
|
|
xml::event_parser class destructor.
|
|
Override this member function to receive the cdata mesage. This member function is called when the parser encounters a <![CDATA[]]> section in the XML data. The default implementation just calls the text() member function to handle the text inside the CDATA section.
|
|
Override this member function to receive the comment message. This member function will be called when the XML parser encounters a comment . The default implementation will ignore XML comments and return true.
|
|
Override this member function to receive the end_element message. This member function is called when the parser encounters the closing of an element.
|
|
If there was an error parsing the XML data, (indicated by one of the parsing functions returning false), you can call this function to get a message describing the error.
|
|
Call this function to parse a chunk of xml data. When you are done feeding the parser chucks of data you need to call the parse_finish member function.
|
|
Call this member function to parse the given file.
|
|
Finish parsing chunked data. You only need to call this member function is you were parsing chunked xml data via the parse_chunk member function.
|
|
Parse what ever data that can be read from the given stream.
|
|
Override this member function to receive the procesing_instruction message. This member function will be called when the XML parser encounters a processing instruction <?target data?>. The default implementation will ignore processing instructions and return true.
|
|
Set the error message that will be returned from the get_error_message() member function. If one of your callback functions returns false and does not first call this memeber function, "Unknown Error" will be returned from get_error_message().
|
|
Override this member function to receive the start_element message. This member function is called when the parser encounters an xml element.
|
|
Override this member function to receive the text message. This member function is called when the parser encounters text nodes.
|
|
Override this memeber function to receive parser warnings. The default behaviour is to ignore warnings.
|