void Bank::createFromXml( istringstream& is, ProgramList& list ) { Document doc; try { doc.Parse( is.str(), true ); Node* moduleNode = doc.FirstChild( "Module", false ); if( moduleNode != NULL ) { Program* program = new Program(); createFromXml( is, *program ); list.push_back( program ); } else { Iterator< Element > it( "Program" ); for( it = it.begin( &doc ); it != it.end(); it++ ) { Program* program = new Program(); Element* programElement = it.Get(); readProgram( programElement, program ); list.push_back( program ); } } } catch( const exception& e ) { TRACE( e.what() ); } }
void Bank::createFromXml( istringstream& is, Program& program ) { Document doc; try { doc.Parse( is.str(), true ); Node* root = &doc; Node* programNode = doc.FirstChild( "Program", false ); if( programNode != NULL ) { root = programNode; } Iterator< Element > it( "Module" ); for( it = it.begin( root ); it != it.end(); it++ ) { ModuleData* data = new ModuleData(); Element* moduleElement = it.Get(); readModule( moduleElement, data ); program.addModule( data ); } } catch( const exception& e ) { TRACE( e.what() ); } }