Rev | Line | |
---|
[352] | 1 | #ifndef __XMLIO_CXML_PARSER_IMPL__ |
---|
| 2 | #define __XMLIO_CXML_PARSER_IMPL__ |
---|
| 3 | |
---|
| 4 | /// xios headers /// |
---|
| 5 | #include "xml_parser.hpp" |
---|
| 6 | |
---|
| 7 | namespace xios |
---|
| 8 | { |
---|
| 9 | namespace xml |
---|
| 10 | { |
---|
| 11 | template <class T> void CXMLParser::ParseInclude(StdIStream & stream, T& object) |
---|
| 12 | { |
---|
| 13 | StdOStringStream oss; |
---|
| 14 | while(!stream.eof() && !stream.fail ()) |
---|
| 15 | oss.put(stream.get()); |
---|
| 16 | try |
---|
| 17 | { |
---|
| 18 | const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); |
---|
| 19 | rapidxml::xml_document<char> doc; |
---|
| 20 | doc.parse<0>(const_cast<char*>(xmlcontent.c_str())); |
---|
| 21 | CXMLNode node(doc.first_node()); |
---|
| 22 | object.parse(node); |
---|
| 23 | } |
---|
| 24 | catch (rapidxml::parse_error & exc) |
---|
| 25 | { |
---|
| 26 | ERROR("CXMLParser::ParseStream(StdIStream & stream)", |
---|
| 27 | << "RapidXML error : " << exc.what() << " !"); |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | } // namespace xml |
---|
| 32 | } // namespace xios |
---|
| 33 | |
---|
| 34 | #endif // __XMLIO_CXML_PARSER_IMPL__ |
---|
| 35 | |
---|
Note: See
TracBrowser
for help on using the repository browser.