33 #include "BESXMLUtils.h"
53 va_start( args, msg );
55 vsnprintf(mymsg,
sizeof mymsg, msg, args);
57 vector<string> *myerrors = (vector<string> *) context;
58 myerrors->push_back(mymsg);
76 if (node->properties == NULL) {
80 xmlAttr *curr_prop = node->properties;
82 string prop_name = (
char *) curr_prop->name;
85 xmlNode *curr_val = curr_prop->children;
86 if (curr_val && curr_val->content) {
90 props[prop_name] = prop_val;
92 curr_prop = curr_prop->next;
108 name = (
char *) node->name;
111 xmlNode *child_node = node->children;
113 while (child_node && !done) {
114 if (child_node->type == XML_TEXT_NODE) {
115 if (child_node->content) {
124 child_node = child_node->next;
139 xmlNode *child_node = NULL;
141 child_node = node->children;
143 while (child_node && !done) {
144 if (child_node->type == XML_ELEMENT_NODE) {
149 child_node = child_node->next;
167 child_node = child_node->next;
169 while (child_node && !done) {
170 if (child_node->type == XML_ELEMENT_NODE) {
175 child_node = child_node->next;
190 BESXMLUtils::GetChild(xmlNode *node,
const string &child_name,
string &child_value, map<string, string> &child_props)
192 xmlNode *child_node = NULL;
194 child_node = node->children;
196 while (child_node && !done) {
197 if (child_node->type == XML_ELEMENT_NODE) {
198 string name = (
char *) child_node->name;
200 if (name == child_name) {
205 child_node = child_node->next;
209 child_node = child_node->next;
static std::string xml2id(std::string in)
static void removeLeadingAndTrailingBlanks(std::string &key)
static void GetNodeInfo(xmlNode *node, std::string &name, std::string &value, std::map< std::string, std::string > &props)
get the name, value if any, and any properties for the specified node
static void GetProps(xmlNode *node, std::map< std::string, std::string > &props)
given an xml node, build the map of properties (xml attributes) for that node
static xmlNode * GetFirstChild(xmlNode *node, std::string &child_name, std::string &child_value, std::map< std::string, std::string > &child_props)
get the first element child node for the given node
static xmlNode * GetChild(xmlNode *node, const std::string &child_name, std::string &child_value, std::map< std::string, std::string > &child_props)
get the element child node of the given node with the given name
static xmlNode * GetNextChild(xmlNode *child_node, std::string &next_name, std::string &next_value, std::map< std::string, std::string > &next_props)
get the next element child node after the given child node
static void XMLErrorFunc(void *context, const char *msg,...)
error function used by libxml2 to report errors