Ignore:
Timestamp:
12/06/17 18:36:26 (6 years ago)
Author:
ymipsl
Message:

Fix : when arithmetic field expression is defined, other xml node are now taking into account.

YM

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  
    15091509   void CField::parse(xml::CXMLNode& node) 
    15101510   { 
     1511      string newContent ; 
    15111512      SuperClass::parse(node); 
    1512       if (!node.getContent(this->content)) 
     1513      if (node.goToChildElement()) 
    15131514      { 
    1514         if (node.goToChildElement()) 
     1515        do 
    15151516        { 
    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 ; 
    15231523    } 
    15241524 
  • XIOS/dev/XIOS_DEV_CMIP6/src/xml_node.cpp

    r591 r1363  
    11#include "xml_node.hpp" 
     2#include <boost/algorithm/string.hpp> 
    23 
    34namespace xios 
     
    2627         bool retvalue = false; 
    2728         for(rapidxml::xml_node<char> * nextElement = this->node->next_sibling(); 
    28                                       ; nextElement = this->node->next_sibling()) 
     29                                      ; nextElement = nextElement->next_sibling()) 
    2930         { 
    3031            if (nextElement == NULL) break; 
     
    6768         return (!retvalue); 
    6869      } 
    69  
     70/* 
    7071      bool CXMLNode::getContent(StdString & content) 
    7172      { 
     
    7374         content.assign(this->node->value(), this->node->value_size()); 
    7475         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 ; 
    7593      } 
    7694 
Note: See TracChangeset for help on using the changeset viewer.