opentl::core::parser::XMLParser Class Reference
class to fully scan a xml document
More...
Inherited by opentl::core::parser::COLLADAParser, and opentl::core::parser::FootprintParser.
List of all members.
|
Classes |
struct | TagInfo |
struct | Token |
struct | XMLTag |
Public Types |
Public Member Functions |
XMLTag * | find (XMLTag *tag, const char *elemname, const char *n="", const char *v="") |
XMLTag * | find (XMLTag *tag, std::string elemname, std::string n="", std::string v="") |
std::vector< XMLParser::XMLTag * > | findall (XMLTag *tag, std::string elemname, std::string n, std::string v) |
std::vector< XMLParser::XMLTag * > | findall (XMLTag *tag, const char *elemname, const char *n="", const char *v="") |
int | getFilesize (const char *filename) |
bool | getnexttoken (char *buffer, int &pos, Token &token, int length) |
XMLTag * | getRootTag () |
bool | isWhitespace (char c) |
std::string | itoa (int number) |
void | output (XMLParser::XMLTag *tag, int depth) |
void | output () |
int | parseFile (std::string filename) |
bool | toBool (const std::string &s) |
double | toDouble (const std::string &s) |
int | toInt (const std::string &s) |
void | trim (char *str) |
| XMLParser () |
virtual | ~XMLParser () |
Protected Attributes |
int | m_lineNr |
XMLTag * | m_root |
Detailed Description
class to fully scan a xml document
- Author:
- Thomas Friedlhuber <friedlhu@in.tum.de>
Member Enumeration Documentation
possible states for tag during parsing process
- Enumerator:
-
COMMENT |
|
BEGIN |
|
NEWTAG |
|
READNAME |
|
READATTRIBUTE |
|
READVALUE |
|
PRECLOSEDTAG |
|
READARRAY |
|
READELEMENTS |
|
REOPENTAG |
|
NAMECORRECT |
|
possible states for token during parsing process
- Enumerator:
-
EMPTY |
|
OPENTAG |
|
OPENTAGSLASH |
|
CLOSETAG |
|
CLOSETAGSLASH |
|
EQUALCHAR |
|
NAME |
|
STRVALUE |
|
ARRAYVALUE |
|
COMMENTBEGIN |
|
COMMENTEND |
|
Constructor & Destructor Documentation
opentl::core::parser::XMLParser::XMLParser |
( |
|
) |
|
virtual opentl::core::parser::XMLParser::~XMLParser |
( |
|
) |
[virtual] |
Member Function Documentation
XMLTag* opentl::core::parser::XMLParser::find |
( |
XMLTag * |
tag, |
|
|
const char * |
elemname, |
|
|
const char * |
n = "" , |
|
|
const char * |
v = "" | |
|
) |
| | |
search for a tag
- Parameters:
-
| tag | pointer to tag the search should start |
| elemname | name of search tag |
| n | attribute name of search tag |
| v | attribute value of search tag |
- Returns:
- the first tag founded
XMLTag* opentl::core::parser::XMLParser::find |
( |
XMLTag * |
tag, |
|
|
std::string |
elemname, |
|
|
std::string |
n = "" , |
|
|
std::string |
v = "" | |
|
) |
| | |
search for a tag
- Parameters:
-
| tag | pointer to tag the search should start |
| elemname | name of search tag |
| n | attribute name of search tag |
| v | attribute value of search tag |
- Returns:
- the first tag founded
std::vector<XMLParser::XMLTag*> opentl::core::parser::XMLParser::findall |
( |
XMLTag * |
tag, |
|
|
std::string |
elemname, |
|
|
std::string |
n, |
|
|
std::string |
v | |
|
) |
| | |
search for a sequence of tags
- Parameters:
-
| tag | pointer to tag the search should start |
| elemname | name of search tag |
| n | attribute name of search tag |
| v | attribute value of search tag |
- Returns:
- all tags founded
std::vector<XMLParser::XMLTag*> opentl::core::parser::XMLParser::findall |
( |
XMLTag * |
tag, |
|
|
const char * |
elemname, |
|
|
const char * |
n = "" , |
|
|
const char * |
v = "" | |
|
) |
| | |
search for a sequence of tags
- Parameters:
-
| tag | pointer to tag the search should start |
| elemname | name of search tag |
| n | attribute name of search tag |
| v | attribute value of search tag |
- Returns:
- all tags founded
int opentl::core::parser::XMLParser::getFilesize |
( |
const char * |
filename |
) |
|
get filesize of a file
- Parameters:
-
- Returns:
- filesize
bool opentl::core::parser::XMLParser::getnexttoken |
( |
char * |
buffer, |
|
|
int & |
pos, |
|
|
Token & |
token, |
|
|
int |
length | |
|
) |
| | |
search for the next token
- Parameters:
-
| buffer | buffer including tokens |
| pos | read position in buffer |
| token | structure to store token result |
| length | length of buffer |
- Returns:
- false if a parsing error occured else true
XMLTag* opentl::core::parser::XMLParser::getRootTag |
( |
|
) |
|
bool opentl::core::parser::XMLParser::isWhitespace |
( |
char |
c |
) |
|
determine if a character is a whitespace
- Parameters:
-
- Returns:
- true if whitespace else false
std::string opentl::core::parser::XMLParser::itoa |
( |
int |
number |
) |
|
converts an integer number to a string value
- Parameters:
-
- Returns:
- string value
print tag values to screen
- Parameters:
-
| tag | corresponding tag |
| depth | xml parsing depth of tag |
void opentl::core::parser::XMLParser::output |
( |
|
) |
|
print parsing result to screen
int opentl::core::parser::XMLParser::parseFile |
( |
std::string |
filename |
) |
|
parse a xml file
- Parameters:
-
- Returns:
- 1 = OK
bool opentl::core::parser::XMLParser::toBool |
( |
const std::string & |
s |
) |
|
convert a string value to an bool value
- Parameters:
-
- Returns:
- bool value
double opentl::core::parser::XMLParser::toDouble |
( |
const std::string & |
s |
) |
|
convert a string value to a double number
- Parameters:
-
- Returns:
- double value
int opentl::core::parser::XMLParser::toInt |
( |
const std::string & |
s |
) |
|
convert a string value to an integer number
- Parameters:
-
- Returns:
- integer value
void opentl::core::parser::XMLParser::trim |
( |
char * |
str |
) |
|
remove white spaces on the left and right side of a string
- Parameters:
-
Member Data Documentation
current line number of parsing process