+
+void Principal::read_status_xml(const std::string &frame)
+{
+ std::string item_name;
+ xmlDocPtr document;
+ document = xmlParseMemory(frame.c_str(),frame.size());
+ if (document == NULL) {
+ std::cout << "read_status_xml::no se creo documento" << std::endl;
+ return;
+ }
+
+ xmlNodePtr nodo, items, props;
+ nodo = document->children;
+ float tmp;
+
+ if (strcmp((char *)nodo->name, "plantastatus") == 0) {
+ items = nodo->children;
+ while (items != NULL) {
+ tmp = -1;
+ if (items->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(items->name, BAD_CAST"conduct")==0) {
+ tmp = get_float_from_xml(items->children);
+ item_name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ mapItems[item_name]->set_actual_flow(tmp);
+ }
+ }
+ items = items->next;
+ }
+ }
+}
+
+float Principal::get_float_from_xml(xmlNodePtr nodo)
+{
+ float tmp = -1;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"actual_flow")==0) {
+ tmp = atof( (char *)XML_GET_CONTENT(nodo->children) );
+ break;
+ }
+ }
+ nodo = nodo->next;
+ }
+ return tmp;
+}
+