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);
72 if (node->properties == NULL) {
76 xmlAttr *curr_prop = node->properties;
78 string prop_name = (
char *) curr_prop->name;
81 xmlNode *curr_val = curr_prop->children;
82 if (curr_val && curr_val->content) {
86 props[prop_name] = prop_val;
88 curr_prop = curr_prop->next;
104 name = (
char *) node->name;
107 xmlNode *child_node = node->children;
109 while (child_node && !done) {
110 if (child_node->type == XML_TEXT_NODE) {
111 if (child_node->content) {
120 child_node = child_node->next;
135 xmlNode *child_node = NULL;
137 child_node = node->children;
139 while (child_node && !done) {
140 if (child_node->type == XML_ELEMENT_NODE) {
145 child_node = child_node->next;
163 child_node = child_node->next;
165 while (child_node && !done) {
166 if (child_node->type == XML_ELEMENT_NODE) {
171 child_node = child_node->next;
186 BESXMLUtils::GetChild(xmlNode *node,
const string &child_name,
string &child_value, map<string, string> &child_props)
188 xmlNode *child_node = NULL;
190 child_node = node->children;
192 while (child_node && !done) {
193 if (child_node->type == XML_ELEMENT_NODE) {
194 string name = (
char *) child_node->name;
196 if (name == child_name) {
201 child_node = child_node->next;
205 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 (xml attributes) 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