ContRap-Core
|
Class XMLStreamParser is a stream based XML parser for text strings. More...
#include <xmlparser.h>
Public Member Functions | |
XMLStreamParser (const std::string &text) | |
Starts parsing of a string. | |
~XMLStreamParser () | |
Stops parsing. | |
bool | next_start_tag () |
Moves to the next start tag. | |
bool | next_end_tag () |
Moves to the next end tag. | |
bool | is_at_end () |
Returns true if the parser has no more tokens left to parse. | |
const std::string & | get_tag () const |
Returns the name of the current tag. | |
const std::map< std::string, std::string > & | get_attributes () const |
Returns the attributes of the current tag. | |
const std::string & | get_text () const |
Returns the current text. | |
Protected Attributes | |
StringTokenizer | tokenizer |
String tokenizer which parses the string. | |
std::string | tag |
Current tag. | |
std::map< std::string, std::string > | attributes |
Current attributes. | |
std::string | text |
Text. |
Class XMLStreamParser is a stream based XML parser for text strings.
crp::XMLStreamParser::XMLStreamParser | ( | const std::string & | text | ) |
Starts parsing of a string.
text | String to parse |
crp::XMLStreamParser::~XMLStreamParser | ( | ) |
Stops parsing.
const std::map<std::string, std::string>& crp::XMLStreamParser::get_attributes | ( | ) | const [inline] |
Returns the attributes of the current tag.
const std::string& crp::XMLStreamParser::get_tag | ( | ) | const [inline] |
Returns the name of the current tag.
const std::string& crp::XMLStreamParser::get_text | ( | ) | const [inline] |
Returns the current text.
bool crp::XMLStreamParser::is_at_end | ( | ) |
Returns true if the parser has no more tokens left to parse.
bool crp::XMLStreamParser::next_end_tag | ( | ) |
Moves to the next end tag.
This operation only changes the tag name regardless of which tags the parser passes until the end tag is reached.
bool crp::XMLStreamParser::next_start_tag | ( | ) |
Moves to the next start tag.
When the parser reaches the next start tag it reads its attributes and the text, which follows immediately after the tag. The parameters can be queried by calling to one of the query methods.
std::map<std::string, std::string> crp::XMLStreamParser::attributes [protected] |
Current attributes.
std::string crp::XMLStreamParser::tag [protected] |
Current tag.
std::string crp::XMLStreamParser::text [protected] |
Text.
StringTokenizer crp::XMLStreamParser::tokenizer [protected] |
String tokenizer which parses the string.