#ifndef __XMLIO_XML_PARSER__ #define __XMLIO_XML_PARSER__ #include // Utilisation de la STL using std::string; namespace XMLIOSERVER { namespace XML { using XMLIOSERVER::Context; class XMLParser { public : static void Parse(XMLNode& _node) { THashAttributes attributes; _node.goToChildElement(); // On se place sur le premier élément enfant du noeud racine. atexit (&Context::FreeMemory); // Pour supprimer la mémoire liée à l'allocation dynamique en fin d'exécution du programme. do { // Traitement de l'identifiant _node.getAttributes(attributes); if (attributes.end() == attributes.find("id")) { WARNING("Le context ne sera pas traité car il n'est pas identifié !"); continue; } if( Context::GetAllListObject().find(attributes["id"]) != Context::GetAllListObject().end()) { WARNING("Le context ne sera pas traité car il existe déjà un autre context possédant le même nom !"); continue; } Context::SetCurrentContext(attributes["id"]); Context& context = *Context::CreateObject(attributes["id"]); if (attributes.end() != attributes.find("calendar_type") && attributes.end() != attributes.find("start_date")) context.setCalendar(attributes["calendar_type"], attributes["start_date"]); context.parse(_node); attributes.clear(); } while (_node.goToNextElement()); } }; // class XMLParser } // namespace XML }// namespace XMLIOSERVER #endif // __XMLIO_XML_PARSER__