28 const std::string &title)
30 if (tinyxml2::XMLDocument::Parse(
str.c_str()))
35 static std::string
to_string(
const tinyxml2::XMLDocument &doc)
37 tinyxml2::XMLPrinter printer;
39 return printer.CStr();
44#if OVPN_TINYXML2_HAS_ERROR_NAME
45 std::string
ret = doc.ErrorName();
47 tinyxml2::XMLError error = doc.ErrorID();
48 std::string
ret{
"XMLError " + error};
50#if OVPN_TINYXML2_HAS_ERROR_STR
51 const char *es = doc.ErrorStr();
58 const char *es1 = doc.GetErrorStr1();
59 const char *es2 = doc.GetErrorStr2();
74 template <
typename T,
typename... Args>
75 static std::string
find_text(
const tinyxml2::XMLNode *node,
79 const tinyxml2::XMLElement *e =
find(node, first, args...);
86 template <
typename T,
typename... Args>
87 static const tinyxml2::XMLElement *
find(
const tinyxml2::XMLNode *node,
91 const tinyxml2::XMLElement *e =
find(node, first);
97 static const tinyxml2::XMLElement *
find(
const tinyxml2::XMLNode *node,
98 const std::string &first)
100 return node->FirstChildElement(first.c_str());
103 static const tinyxml2::XMLElement *
find(
const tinyxml2::XMLNode *node,
106 return node->FirstChildElement(first);
109 static const tinyxml2::XMLElement *
find(
const tinyxml2::XMLElement *elem)
114 static const tinyxml2::XMLElement *
next_sibling(
const tinyxml2::XMLNode *node,
115 const std::string &name)
117 return node->NextSiblingElement(name.c_str());
120 static const tinyxml2::XMLElement *
next_sibling(
const tinyxml2::XMLNode *node,
123 return node->NextSiblingElement(name);
126 static const tinyxml2::XMLElement *
next_sibling(
const tinyxml2::XMLNode *node)
128 return node->NextSiblingElement();
static std::string format_error(const tinyxml2::XMLDocument &doc)
static const tinyxml2::XMLElement * find(const tinyxml2::XMLNode *node, const char *first)
OPENVPN_EXCEPTION(xml_parse)
static const tinyxml2::XMLElement * next_sibling(const tinyxml2::XMLNode *node, const char *name)
static const tinyxml2::XMLElement * find(const tinyxml2::XMLNode *node, const T &first, Args... args)
static const tinyxml2::XMLElement * next_sibling(const tinyxml2::XMLNode *node)
static const tinyxml2::XMLElement * find(const tinyxml2::XMLElement *elem)
static const tinyxml2::XMLElement * next_sibling(const tinyxml2::XMLNode *node, const std::string &name)
static std::string find_text(const tinyxml2::XMLNode *node, const T &first, Args... args)
static std::string to_string(const tinyxml2::XMLDocument &doc)
static const tinyxml2::XMLElement * find(const tinyxml2::XMLNode *node, const std::string &first)
#define OPENVPN_THROW(exc, stuff)
Document(const std::string &str, const std::string &title)
os<< "Session Name: "<< tbc-> session_name<< '\n';os<< "Layer: "<< tbc-> layer str()<< '\n'