00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _xmlReader_cc
00028 #define _xmlReader_cc
00029
00030 #include "xmlReader.h"
00031
00032 #include <string>
00033
00034 namespace BSUtilities {
00035 namespace xmlr {
00036
00038 const std::string XmlReadError::XMLREADERROR
00039 = "error while reading xml file!";
00040
00042
00048 TiXmlHandle xmlInit (const std::string &filename)
00049 {
00050 TiXmlDocument *doc = new TiXmlDocument(filename.c_str ());
00051
00052 if (!doc || !doc->LoadFile ())
00053 {
00054 delete doc;
00055 throw XmlReadError ("xml file can not be loaded!");
00056 }
00057
00058 return TiXmlHandle (doc->RootElement ());
00059 }
00060
00062
00067 void xmlFinish (TiXmlHandle &element)
00068 {
00069 if (TiXmlDocument *doc = (element.Element())->GetDocument ())
00070 {
00071 delete doc;
00072 }
00073 }
00074
00075 }
00076 }
00077 #endif