87 std::vector< Commodity_t > retVal;
94 inFile.open( wApp-> docRoot() +
"/iso-4217-currencies.xml" );
99 inFile.seekg( 0, std::ios::end );
100 std::streampos length = inFile.tellg();
101 inFile.seekg( 0, std::ios::beg );
114 DynBuf db(((
int)length)+10000);
115 inFile.read( db.buffer, length );
118 db.buffer[length] = 0;
124 rapidxml::xml_document<> doc;
127 doc.parse<0>( db.buffer );
129 catch( std::exception & err )
131 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << err.what() << std::endl;
135 auto _processCurrency = [&]( rapidxml::xml_node<> * topNode )
137 for(
auto node = topNode-> first_node(); node; node = node-> next_sibling() )
141 node-> first_attribute(
"isocode" )-> value(),
142 node-> first_attribute(
"fullname" )-> value(),
143 node-> first_attribute(
"unitname" )-> value(),
144 node-> first_attribute(
"partname" )-> value(),
145 node-> first_attribute(
"namespace" )-> value(),
146 node-> first_attribute(
"exchange-code" )-> value(),
147 node-> first_attribute(
"parts-per-unit" )-> value(),
148 node-> first_attribute(
"smallest-fraction" )-> value(),
149 node-> first_attribute(
"local-symbol" )-> value()
152 retVal.push_back( commodity );
158 for(
auto node = doc.first_node(); node; node = node-> next_sibling() )
160 if( std::string(node-> name()) ==
"currencylist" )
161 _processCurrency( node );