Changeset 2614 for XIOS3/trunk/src/xml_parser.cpp
- Timestamp:
- 03/12/24 20:02:35 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/xml_parser.cpp
r1622 r2614 11 11 namespace xml 12 12 { 13 string CXMLParser::currentIncludePath_="." ; 14 15 string CXMLParser::updateIncludePath(const string& filePath) 16 { 17 string path = strTrim(filePath) ; 18 vector<string> match=splitRegex(path+'/',"/" ) ; 19 20 // check if empty path 21 bool isEmpty=true ; 22 for(auto& m : match) 23 if (!m.empty()) 24 { 25 isEmpty=false ; 26 break ; 27 } 28 29 if (isEmpty) ERROR("string CXMLParser::updatePath(const string& filePath)", 30 << "File path to include an new XML is empty :'"<<filePath<<"'" ); 31 32 if (match.back().empty()) ERROR("string CXMLParser::updatePath(const string& filePath)", 33 << "File path to include an new XML must not be a directory but a file :'"<<filePath<<"'" ); 34 bool isAbsolutePath = match.front().empty() ; 35 36 if (isAbsolutePath) currentIncludePath_="" ; 37 for(int i=0; i<match.size()-1; ++i) if (! match[i].empty()) currentIncludePath_ = currentIncludePath_ + "/" + match[i] ; 38 39 string finalPath = currentIncludePath_ + "/" + match.back() ; 40 41 return finalPath ; 42 } 43 13 44 /// ////////////////////// Définitions ////////////////////// /// 14 45 … … 52 83 << "Root element should be named simulation (actual = \'" 53 84 << node.getElementName() << "\')!"); 54 55 std::set<StdString>::iterator it;56 std::set<StdString>::const_iterator itE = parseContextList.end();57 bool isParseAll = (parseContextList.empty());58 85 try 59 86 { 60 if (node.goToChildElement()) 61 { 62 do 63 { 64 CContextGroup* group_context = CContext::getRoot() ; 65 66 attributes = node.getAttributes(); 67 68 if (attributes.end() == attributes.find("id")) 69 { 70 DEBUG("The context will not be processed because it is not identified (missing id)"); 71 continue; 72 } 73 74 CContext::setCurrent(attributes["id"]) ; 75 76 if (isParseAll) 77 { 78 CContext* context = CContext::create(attributes["id"]); 79 context->parse(node); 80 81 attributes.clear(); 82 } 83 else 84 { 85 it = parseContextList.find(attributes["id"]); 86 if (itE != it) 87 { 88 CContext* context = CContext::create(*it); 89 context->parse(node); 90 91 attributes.clear(); 92 } 93 } 94 } while (node.goToNextElement()); 95 } 87 CContextGroup* rootContext = CContext::getRoot() ; 88 rootContext->parse(node, true, parseContextList) ; 96 89 } 97 90 catch(CException& e)
Note: See TracChangeset
for help on using the changeset viewer.