38 using std::stringstream ;
89 BESDEBUG(
"besxml",
"building request plan for xml document: "
90 << endl <<
_dhi->
data[
"XMLDoc"] << endl ) ;
95 <<
"] building" << endl ;
101 xmlNode *root_element = NULL ;
102 xmlNode *current_node = NULL ;
107 vector<string> parseerrors ;
110 doc = xmlParseDoc( (
unsigned char *)
_dhi->
data[
"XMLDoc"].c_str() ) ;
113 string err =
"Problem parsing the request xml document:\n" ;
114 bool isfirst = true ;
115 vector<string>::const_iterator i = parseerrors.begin() ;
116 vector<string>::const_iterator e = parseerrors.end() ;
119 if( !isfirst && (*i).compare( 0, 6,
"Entity" ) == 0 )
130 root_element = xmlDocGetRootElement( doc ) ;
133 string err =
"There is no root element in the xml document" ;
139 map< string, string> props ;
141 if( root_name !=
"request" )
143 string err = (string)
"The root element should be a request element, "
144 +
"name is " + (
char *)root_element->name ;
149 string err = (string)
"The request element must not contain a value, "
158 string err = (string)
"request id value empty" ;
167 bool has_response = false ;
168 current_node = root_element->children ;
170 while( current_node )
172 if( current_node->type == XML_ELEMENT_NODE )
176 string node_name = (
char *)current_node->name ;
177 BESDEBUG(
"besxml",
"looking for command " << node_name
185 string err = (string)
"Failed to build command object for "
191 _cmd_list.push_back( current_cmd ) ;
196 if( has_response && cmd_has_response )
198 string err =
"Multiple responses not allowed" ;
201 has_response = cmd_has_response ;
204 BESDEBUG(
"besxml",
"parse request using " << node_name
209 BESDEBUG(
"besxml", node_name <<
" parsed request, dhi = "
210 << current_dhi << endl ) ;
214 BESDEBUG(
"xml",
"Finding transmitter: " << returnAs
215 <<
" ... " << endl ) ;
220 string s = (string)
"Unable to find transmitter "
229 string err = (string)
"Unable to find command for "
234 current_node = current_node->next ;
249 BESDEBUG(
"besxml",
"Done building request plan" << endl ) ;
259 vector<BESXMLCommand *>::iterator i = _cmd_list.begin() ;
260 vector<BESXMLCommand *>::iterator e = _cmd_list.end() ;
263 (*i)->prep_request() ;
264 _dhi = &(*i)->get_dhi() ;
285 BESDEBUG(
"xml",
"Setting transmitter: " << returnAs
286 <<
" ... " << endl ) ;
291 string s = (string)
"Unable to find transmitter "
308 vector<BESXMLCommand *>::iterator i = _cmd_list.begin() ;
309 vector<BESXMLCommand *>::iterator e = _cmd_list.end() ;
312 _dhi = &(*i)->get_dhi() ;
335 vector<BESXMLCommand *>::iterator i = _cmd_list.begin() ;
336 vector<BESXMLCommand *>::iterator e = _cmd_list.end() ;
339 _dhi = &(*i)->get_dhi() ;
349 vector<BESXMLCommand *>::iterator i = _cmd_list.begin() ;
350 vector<BESXMLCommand *>::iterator e = _cmd_list.end() ;
371 << (
void *)
this <<
")" << endl ;
374 vector<BESXMLCommand *>::const_iterator i = _cmd_list.begin() ;
375 vector<BESXMLCommand *>::const_iterator e = _cmd_list.end() ;