#ifndef __XIOS_CXML_PARSER_IMPL__ #define __XIOS_CXML_PARSER_IMPL__ /// XIOS headers /// #include "xml_parser.hpp" namespace xios { namespace xml { template void CXMLParser::ParseInclude(const string& fluxId, T& object) { string parentPath = currentIncludePath_ ; string filePath = updateIncludePath(fluxId) ; StdIFStream stream(filePath, StdIFStream::in ) ; if ( (stream.rdstate() & std::ifstream::failbit ) != 0 ) ERROR("template void CXMLParser::ParseInclude(const string& fluxId, T& object)", < file" ); if (!stream.good()) ERROR("template void CXMLParser::ParseInclude(const string& fluxId, T& object)", << "[ filename = " << fluxId << " ] Bad xml stream !"); StdOStringStream oss; while(!stream.eof() && !stream.fail ()) oss.put(stream.get()); const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); try { rapidxml::xml_document doc; doc.parse<0>(const_cast(xmlcontent.c_str())); CXMLNode node(doc.first_node()); object.parse(node); currentIncludePath_ = parentPath ; } catch (rapidxml::parse_error & exc) { const char* ptr = exc.where() ; const char* begin = xmlcontent.c_str() ; const char* content=oss.str().c_str() ; size_t pos=ptr-begin ; int lineNumber = 1 ; int columnNumber = 0 ; const char* line; const char* endLine; for(const char* i=content;i at character "<< pos<<" line "< void CXMLParser::ParseInclude(const string& fluxId, T& object, const std::set& parseContextList) { string parentPath = currentIncludePath_ ; // save current path string filePath = updateIncludePath(fluxId) ; // path is updated StdIFStream stream(filePath, StdIFStream::in ) ; if ( (stream.rdstate() & std::ifstream::failbit ) != 0 ) ERROR("template void CXMLParser::ParseInclude(const string& fluxId, T& object)", < file" ); if (!stream.good()) ERROR("template void CXMLParser::ParseInclude(const string& fluxId, T& object)", << "[ filename = " << fluxId << " ] Bad xml stream !"); StdOStringStream oss; while(!stream.eof() && !stream.fail ()) oss.put(stream.get()); const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); try { rapidxml::xml_document doc; doc.parse<0>(const_cast(xmlcontent.c_str())); CXMLNode node(doc.first_node()); object.parse(node, true, parseContextList); currentIncludePath_ = parentPath ; // restore include path } catch (rapidxml::parse_error & exc) { const char* ptr = exc.where() ; const char* begin = xmlcontent.c_str() ; const char* content=oss.str().c_str() ; size_t pos=ptr-begin ; int lineNumber = 1 ; int columnNumber = 0 ; const char* line; const char* endLine; for(const char* i=content;i at character "<< pos<<" line "<