Changeset 1642 for XIOS/dev/branch_openmp/src/xml_parser.cpp
- Timestamp:
- 01/23/19 10:31:44 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/xml_parser.cpp
r1460 r1642 14 14 15 15 void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList) 16 TRY 16 17 { 17 18 StdIFStream ifs ( filename.c_str() , StdIFStream::in ); … … 22 23 CXMLParser::ParseStream(ifs, filename, parseContextList); 23 24 } 25 CATCH 24 26 25 27 void CXMLParser::ParseString(const StdString & xmlContent) … … 54 56 std::set<StdString>::const_iterator itE = parseContextList.end(); 55 57 bool isParseAll = (parseContextList.empty()); 56 if (node.goToChildElement())58 try 57 59 { 58 do 59 { 60 CContextGroup* group_context = CContext::getRoot() ; 60 if (node.goToChildElement()) 61 { 62 do 63 { 64 CContextGroup* group_context = CContext::getRoot() ; 61 65 62 attributes = node.getAttributes();66 attributes = node.getAttributes(); 63 67 64 if (attributes.end() == attributes.find("id"))65 {66 DEBUG("The context will not be processed because it is not identified (missing id)");67 continue;68 }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 } 69 73 70 CContext::setCurrent(attributes["id"]) ;74 CContext::setCurrent(attributes["id"]) ; 71 75 72 73 if (isParseAll) 74 { 75 CContext* context = CContext::create(attributes["id"]); 76 context->parse(node); 77 78 attributes.clear(); 79 } 80 else 81 { 82 it = parseContextList.find(attributes["id"]); 83 if (itE != it) 76 if (isParseAll) 84 77 { 85 CContext* context = CContext::create( *it);78 CContext* context = CContext::create(attributes["id"]); 86 79 context->parse(node); 87 80 88 81 attributes.clear(); 89 82 } 90 } 91 } while (node.goToNextElement()); 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 } 92 96 } 97 catch(CException& e) 98 { 99 CException::StackInfo stk; 100 stk.info.append("Exception occurred while parsing XML file \""); 101 stk.info.append(attributes["src"]); 102 stk.info.append("\".\n"); 103 stk.file = FILE_NAME; 104 stk.function = FUNCTION_NAME; 105 stk.line = __LINE__; 106 e.stack.push_back(stk); 107 if (CXios::xiosStack) 108 throw; 109 else 110 throw 0; 111 } 112 catch(...) 113 { 114 CException exc; 115 CException::StackInfo stk; 116 stk.info.append("Exception occurred while parsing XML file \""); 117 stk.info.append(attributes["src"]); 118 stk.info.append("\".\n"); 119 stk.file = FILE_NAME; 120 stk.function = FUNCTION_NAME; 121 stk.line = __LINE__; 122 exc.stack.push_back(stk); 123 if (CXios::xiosStack) 124 throw exc; 125 else 126 throw 0; 127 } 128 93 129 } 94 130 catch (rapidxml::parse_error & exc) … … 110 146 << "Error is occuring when parsing XML flux from <"<<fluxId<<"> at character "<< pos<<" line "<<lineNumber<<" column "<< columnNumber<< endl 111 147 << strLine<<endl 112 << string(columnNumber-1,'x')<<'^'<<endl 113 <<" Error : " << exc.what() )148 << string(columnNumber-1,'x')<<'^'<<endl) 149 // <<" Error : " << exc.what() ) 114 150 } 115 151 }
Note: See TracChangeset
for help on using the changeset viewer.