00001 #ifndef UTILS_XML_PARSING_H 00002 #define UTILS_XML_PARSING_H 00003 00004 #include <string> 00005 #include <stdexcept> 00006 00007 #include <TinyXML++/ticpp.h> 00008 00013 namespace Utils 00014 { 00019 namespace XML 00020 { 00024 typedef ticpp::Iterator<ticpp::Element> ElementType; 00028 typedef ticpp::Iterator<ticpp::Node> NodeType; 00036 std::string GetAttribute(const ElementType& element, const std::string& name); 00045 int GetAttributeAsInteger(const ElementType& element, const std::string& name); 00054 unsigned GetAttributeAsUnsigned(const ElementType& element, const std::string& name); 00063 double GetAttributeAsDouble(const ElementType& element, const std::string& name); 00072 unsigned GetAttributeAsBool(const ElementType& element, const std::string& name); 00073 00077 class XmlError 00078 : public std::runtime_error 00079 { 00080 public: 00085 XmlError(const std::string& message) 00086 : std::runtime_error(message) 00087 { 00088 } 00089 }; 00090 } 00091 } 00092 00093 #endif//UTILS_XML_PARSING_H