ContRap-Core
Public Member Functions | Protected Member Functions | Protected Attributes

crp::XMLParser Class Reference

Class XMLParser is an event driven base class to parse XML formatted strings. More...

#include <xmlparser.h>

Inheritance diagram for crp::XMLParser:
crp::XMLDataPool crp::XMLPool crp::XMLTextLayout crp::ModuleInfo crp::Options

Public Member Functions

 XMLParser (const std::string &text="")
 Creates a new parser.
virtual ~XMLParser ()
 Cleans up the memory.
void set_text (const std::string &text)
 Sets the formatted text string and parses the contents.
void parse ()
 Parses the current text.

Protected Member Functions

void parse (StringTokenizer &tokenizer, const std::string &tag)
 Parser functions.
bool parse_attributes (const std::string &tag, StringTokenizer &tokenizer, std::map< std::string, std::string > &attributes)
virtual bool start ()
 Start function is called when the parser is entered with new data.
virtual bool enter (const std::string &tag, std::map< std::string, std::string > &attributes, bool end)
 Event functions are called on entering, parsing and leaving tags.
virtual bool content (const std::string &tag, std::map< std::string, std::string > &attributes, const std::string &value, int count)
virtual bool leave (const std::string &tag, std::map< std::string, std::string > &attributes)

Protected Attributes

std::string text
 Text.

Detailed Description

Class XMLParser is an event driven base class to parse XML formatted strings.


Constructor & Destructor Documentation

crp::XMLParser::XMLParser ( const std::string &  text = "")

Creates a new parser.

Parameters:
textXML-formatted string
virtual crp::XMLParser::~XMLParser ( ) [virtual]

Cleans up the memory.


Member Function Documentation

virtual bool crp::XMLParser::content ( const std::string &  tag,
std::map< std::string, std::string > &  attributes,
const std::string &  value,
int  count 
) [protected, virtual]
virtual bool crp::XMLParser::enter ( const std::string &  tag,
std::map< std::string, std::string > &  attributes,
bool  end 
) [protected, virtual]

Event functions are called on entering, parsing and leaving tags.

A false returned by an event function results in an error break.

Reimplemented in crp::XMLDataPool, crp::XMLPool, and crp::XMLTextLayout.

virtual bool crp::XMLParser::leave ( const std::string &  tag,
std::map< std::string, std::string > &  attributes 
) [protected, virtual]
void crp::XMLParser::parse ( )

Parses the current text.

void crp::XMLParser::parse ( StringTokenizer tokenizer,
const std::string &  tag 
) [protected]

Parser functions.

bool crp::XMLParser::parse_attributes ( const std::string &  tag,
StringTokenizer tokenizer,
std::map< std::string, std::string > &  attributes 
) [protected]
void crp::XMLParser::set_text ( const std::string &  text)

Sets the formatted text string and parses the contents.

Parameters:
textText to layout

Reimplemented in crp::XMLTextLayout.

virtual bool crp::XMLParser::start ( ) [protected, virtual]

Start function is called when the parser is entered with new data.

Reimplemented in crp::XMLDataPool, and crp::XMLPool.


Field Documentation

std::string crp::XMLParser::text [protected]

Text.


The documentation for this class was generated from the following file: