/*
 * $Id: XMLUtils_getAttribute.cpp 88 2008-12-10 18:31:39Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Configuration/include/XMLUtils.h"

namespace morpheo {
namespace behavioural {
namespace configuration {

#undef  FUNCTION
#define FUNCTION "getAttribute"
  attribute_t getAttribute(XML_t *             xml,
                           attributes_t      & attributes,
                           const attribute_t & name)
  {
    // List attribute
    attributes_t::iterator it = attributes.find(name); 
    
    if (it == attributes.end())
      throw ERRORMORPHEO(FUNCTION,toString(_("Syntax error, node \"%s\" must have attribute \"%s\"\n"),xml->getName().c_str(),name.c_str()));
  
    attribute_t str = it->second;

    attributes.erase(it);

    return str;
  }

}; // end namespace configuration
}; // end namespace behavioural
}; // end namespace morpheo              
