Changeset 1363
- Timestamp:
- 12/06/17 18:36:26 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp
r1358 r1363 1509 1509 void CField::parse(xml::CXMLNode& node) 1510 1510 { 1511 string newContent ; 1511 1512 SuperClass::parse(node); 1512 if ( !node.getContent(this->content))1513 if (node.goToChildElement()) 1513 1514 { 1514 if (node.goToChildElement())1515 do 1515 1516 { 1516 do 1517 { 1518 if (node.getElementName() == "variable" || node.getElementName() == "variable_group") this->getVirtualVariableGroup()->parseChild(node); 1519 } while (node.goToNextElement()); 1520 node.goToParentElement(); 1521 } 1522 } 1517 if (node.getElementName() == "variable" || node.getElementName() == "variable_group") this->getVirtualVariableGroup()->parseChild(node); 1518 else if (node.getElementName() == "expr") if (node.getContent(newContent)) content+=newContent ; 1519 } while (node.goToNextElement()); 1520 node.goToParentElement(); 1521 } 1522 if (node.getContent(newContent)) content=newContent ; 1523 1523 } 1524 1524 -
XIOS/dev/XIOS_DEV_CMIP6/src/xml_node.cpp
r591 r1363 1 1 #include "xml_node.hpp" 2 #include <boost/algorithm/string.hpp> 2 3 3 4 namespace xios … … 26 27 bool retvalue = false; 27 28 for(rapidxml::xml_node<char> * nextElement = this->node->next_sibling(); 28 ; nextElement = this->node->next_sibling())29 ; nextElement = nextElement->next_sibling()) 29 30 { 30 31 if (nextElement == NULL) break; … … 67 68 return (!retvalue); 68 69 } 69 70 /* 70 71 bool CXMLNode::getContent(StdString & content) 71 72 { … … 73 74 content.assign(this->node->value(), this->node->value_size()); 74 75 return (true); 76 } 77 */ 78 bool CXMLNode::getContent(StdString & content) 79 { 80 content="" ; 81 bool retvalue = false; 82 83 rapidxml::xml_node<char> * nextElement = this->node->first_node(); 84 while (nextElement != NULL) 85 { 86 if (nextElement->type() == rapidxml::node_data) content=content+std::string(nextElement->value(),nextElement->value_size()); 87 nextElement = nextElement->next_sibling(); 88 } 89 boost::algorithm::replace_all(content,"\n"," ") ; 90 boost::algorithm::trim(content) ; 91 if (content.size()==0) return false ; 92 else return true ; 75 93 } 76 94
Note: See TracChangeset
for help on using the changeset viewer.