33 #include "BESXMLUtils.h" 49 va_start( args, msg );
51 vsnprintf(mymsg,
sizeof mymsg, msg, args);
53 vector<string> *myerrors = (vector<string> *) context;
54 myerrors->push_back(mymsg);
71 if (node->properties == NULL) {
75 xmlAttr *curr_prop = node->properties;
77 string prop_name = (
char *) curr_prop->name;
80 xmlNode *curr_val = curr_prop->children;
81 if (curr_val && curr_val->content) {
85 props[prop_name] = prop_val;
87 curr_prop = curr_prop->next;
102 name = (
char *) node->name;
105 xmlNode *child_node = node->children;
107 while (child_node && !done) {
108 if (child_node->type == XML_TEXT_NODE) {
109 if (child_node->content) {
118 child_node = child_node->next;
133 xmlNode *child_node = NULL;
135 child_node = node->children;
137 while (child_node && !done) {
138 if (child_node->type == XML_ELEMENT_NODE) {
143 child_node = child_node->next;
161 child_node = child_node->next;
163 while (child_node && !done) {
164 if (child_node->type == XML_ELEMENT_NODE) {
169 child_node = child_node->next;
184 BESXMLUtils::GetChild(xmlNode *node,
const string &child_name,
string &child_value, map<string, string> &child_props)
186 xmlNode *child_node = NULL;
188 child_node = node->children;
190 while (child_node && !done) {
191 if (child_node->type == XML_ELEMENT_NODE) {
192 string name = (
char *) child_node->name;
194 if (name == child_name) {
199 child_node = child_node->next;
203 child_node = child_node->next;
static xmlNode * GetFirstChild(xmlNode *node, string &child_name, string &child_value, map< string, string > &child_props)
get the first element child node for the given node
static xmlNode * GetNextChild(xmlNode *child_node, string &next_name, string &next_value, map< string, string > &next_props)
get the next element child node after the given child node
static void GetNodeInfo(xmlNode *node, string &name, string &value, map< string, string > &props)
get the name, value if any, and any properties for the specified node
static void removeLeadingAndTrailingBlanks(string &key)
static void XMLErrorFunc(void *context, const char *msg,...)
error function used by libxml2 to report errors
static void GetProps(xmlNode *node, map< string, string > &props)
given an xml node, build the map of properties for that node
static string xml2id(string in)
static xmlNode * GetChild(xmlNode *node, const string &child_name, string &child_value, map< string, string > &child_props)
get the element child node of the given node with the given name