#include <CSXMLHelperTinyXML.h>
Inheritance diagram for CSXMLHelper:
Public Member Functions | |
CSXMLHelper (const std::string &xmlFilename, const std::string &contextNode) | |
virtual | ~CSXMLHelper () |
virtual std::string | getType () |
int | getError (void) |
std::string | getErrorMessage (void) |
int | getInt (const std::string &xpath) |
std::string | getString (const std::string &xpath) |
CSXMLHelper (const std::string &xmlFilename, const std::string &contextNode) | |
virtual | ~CSXMLHelper () |
virtual std::string | getType () |
int | getError (void) |
std::string | getErrorMessage (void) |
int | getInt (const std::string &xpath) |
std::string | getString (const std::string &xpath) |
void | warning (const SAXParseException &toCatch) |
void | error (const SAXParseException &toCatch) |
void | fatalError (const SAXParseException &toCatch) |
void | resetErrors () |
CSXMLHelper (const std::string &xmlFilename, const std::string &contextNode) | |
virtual | ~CSXMLHelper () |
virtual std::string | getType () |
int | getError (void) |
std::string | getErrorMessage (void) |
int | getInt (const std::string &xpath) |
std::string | getString (const std::string &xpath) |
void | warning (const SAXParseException &toCatch) |
void | error (const SAXParseException &toCatch) |
void | fatalError (const SAXParseException &toCatch) |
void | resetErrors () |
Static Public Attributes | |
const char * | CLASS = "CSXMLHelper" |
const char * | CLASS |
const char * | CLASS |
|
Definition at line 103 of file CSXMLHelperTinyXML.cpp. References CSXML_CONTEXT_LOADING_ERROR, CSXML_DOCUMENT_LOADING_ERROR, and CSXML_OK.
00104 { 00105 static char *functionName="CSXMLHelper"; 00106 mError = CSXML_OK; 00107 mXMLdoc = 0; 00108 00109 mXMLdoc = new TiXmlDocument(xmlFilename); 00110 mXMLdoc->setIgnoreNoEndTag(false); 00111 mXMLdoc->SetCondenseWhiteSpace(true); 00112 00113 if (!mXMLdoc) 00114 { 00115 mError = CSXML_CONTEXT_LOADING_ERROR; 00116 std::string errorMessageString; 00117 errorMessageString = std::string("Error - while loading context \"" + contextNode +"\"!"); 00118 mErrorMessageString = mErrorMessageString + "\n"+ errorMessageString; 00119 } 00120 00121 addEntitiesFromFile(xmlFilename, ""); 00122 00123 if (!mXMLdoc->LoadFile() ) 00124 { 00125 mError = CSXML_DOCUMENT_LOADING_ERROR; 00126 std::string errorMessageString; 00127 errorMessageString = std::string("Error - while loading document \"" + xmlFilename +"\"!"); 00128 mErrorMessageString = mErrorMessageString + "\n"+ errorMessageString; 00129 return; 00130 } 00131 mXMLsource = mXMLdoc->FirstChildElement(contextNode); 00132 } |
|
Definition at line 134 of file CSXMLHelperTinyXML.cpp. References LOG_ENTER, and LOG_EXIT.
|
|
|
|
|
|
|
|
|
|
Definition at line 75 of file CSXMLHelperTinyXML.h. References CLASS.
00075 {return (std::string) CLASS;} |
|
Definition at line 491 of file CSXMLHelperTinyXML.cpp. Referenced by CSBitmapLoader::create(), CSGame::loadGameData(), and CSGame::loadLevelData().
00492 {
00493 return mError;
00494 }
|
|
Definition at line 496 of file CSXMLHelperTinyXML.cpp. Referenced by CSBitmapLoader::create(), CSGame::loadGameData(), and CSGame::loadLevelData().
00497 {
00498 return mErrorMessageString;
00499 }
|
|
Definition at line 145 of file CSXMLHelperTinyXML.cpp. References CSXML_XPATH_ERROR, LOG_DEBUG_MESSAGE, LOG_ENTER, LOG_EXIT, and LOG_WARN_MESSAGE. Referenced by CSBitmapLoader::create(), CSGame::loadGameData(), and CSGame::loadLevelData().
00146 { 00147 static char *functionName="getInt"; 00148 LOG_ENTER 00149 int ret = 0; 00150 if (mError != 0) 00151 { 00152 LOG_WARN_MESSAGE("Error") 00153 LOG_EXIT 00154 throw "error"; 00155 } 00156 try 00157 { 00158 TiXmlNode *node = getXPathResult(xpath); 00159 if (node == 0) 00160 { 00161 LOG_EXIT 00162 return 0; 00163 } 00164 if (node->Type() == TiXmlNode::FUNCTION) 00165 { 00166 ret = toInt(*node); 00167 delete node; 00168 node = 0; 00169 } 00170 else 00171 { 00172 TiXmlText *element = node->ToText(); 00173 if (element == 0) 00174 { 00175 LOG_DEBUG_MESSAGE("XPath \"" + xpath + "\" doesn't represent a text element!") 00176 } 00177 ret = toInt(*element); 00178 } 00179 } 00180 catch(...) 00181 { 00182 mError = CSXML_XPATH_ERROR; 00183 std::string errorMessageString; 00184 errorMessageString = "tinyXMLException"; 00185 mErrorMessageString = mErrorMessageString + "\n"+ errorMessageString; 00186 LOG_WARN_MESSAGE(mErrorMessageString) 00187 LOG_EXIT 00188 throw "error"; 00189 } 00190 LOG_EXIT 00191 return ret; 00192 } |
|
Definition at line 194 of file CSXMLHelperTinyXML.cpp. References CSXML_XPATH_ERROR, LOG_DEBUG_MESSAGE, LOG_ENTER, LOG_EXIT, and LOG_WARN_MESSAGE. Referenced by CSBitmapLoader::create(), CSGame::loadGameData(), and CSGame::loadLevelData().
00195 { 00196 static char *functionName="getString"; 00197 LOG_ENTER 00198 std::string cstr; 00199 if (mError != 0) 00200 { 00201 LOG_WARN_MESSAGE("XML! Not properly initialized!") 00202 LOG_EXIT 00203 throw std::string("XML! Not properly initialized!"); 00204 } 00205 try 00206 { 00207 TiXmlNode *node = getXPathResult(xpath); 00208 if (node == 0) 00209 { 00210 LOG_EXIT 00211 return ""; 00212 } 00213 if (node->Type() == TiXmlNode::FUNCTION) 00214 { 00215 cstr = toAscii(*node); 00216 delete node; 00217 node = 0; 00218 } 00219 else 00220 { 00221 TiXmlText *element = node->ToText(); 00222 if (element == 0) 00223 { 00224 LOG_DEBUG_MESSAGE("XPath \"" + xpath + "\" doesn't represent a text element!") 00225 } 00226 cstr = toAscii(*element); 00227 } 00228 00229 } 00230 catch(...) 00231 { 00232 mError = CSXML_XPATH_ERROR; 00233 std::string errorMessageString; 00234 errorMessageString = "tinyXMLException"; 00235 mErrorMessageString = mErrorMessageString + "\n"+ errorMessageString; 00236 LOG_WARN_MESSAGE(mErrorMessageString) 00237 LOG_EXIT 00238 throw "error"; 00239 } 00240 LOG_EXIT 00241 return cstr; 00242 } |
|
Definition at line 41 of file CSXMLHelperTinyXPath.h. References CLASS.
00041 {return (std::string) CLASS;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 56 of file CSXMLHelperXalan.h. References CLASS.
00056 {return (std::string) CLASS;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 11 of file CSXMLHelperTinyXML.cpp. Referenced by getType(). |
|
Definition at line 40 of file CSXMLHelperTinyXPath.h. |
|
Definition at line 55 of file CSXMLHelperXalan.h. |