Last change
on this file since 123 was
123,
checked in by hozdoba, 14 years ago
|
Début de gestion des opérations sur les champs + quelques modifications
|
File size:
1.7 KB
|
Rev | Line | |
---|
[112] | 1 | #ifndef __XMLIO_XML_PARSER__ |
---|
| 2 | #define __XMLIO_XML_PARSER__ |
---|
| 3 | |
---|
| 4 | #include <stdlib.h> |
---|
| 5 | |
---|
| 6 | // Utilisation de la STL |
---|
| 7 | using std::string; |
---|
| 8 | |
---|
| 9 | namespace XMLIOSERVER |
---|
| 10 | { |
---|
| 11 | namespace XML |
---|
| 12 | { |
---|
| 13 | using XMLIOSERVER::Context; |
---|
| 14 | |
---|
| 15 | class XMLParser |
---|
| 16 | { |
---|
| 17 | public : |
---|
| 18 | |
---|
| 19 | static void Parse(XMLNode& _node) |
---|
| 20 | { |
---|
| 21 | THashAttributes attributes; |
---|
| 22 | |
---|
| 23 | _node.goToChildElement(); // On se place sur le premier élément enfant du noeud racine. |
---|
| 24 | atexit (&Context::FreeMemory); // Pour supprimer la mémoire liée à l'allocation dynamique en fin d'exécution du programme. |
---|
| 25 | |
---|
| 26 | do { |
---|
| 27 | // Traitement de l'identifiant |
---|
| 28 | _node.getAttributes(attributes); |
---|
| 29 | |
---|
| 30 | if (attributes.end() == attributes.find("id")) |
---|
| 31 | { WARNING("Le context ne sera pas traité car il n'est pas identifié !"); continue; } |
---|
| 32 | |
---|
| 33 | if( Context::GetAllListObject().find(attributes["id"]) != Context::GetAllListObject().end()) |
---|
| 34 | { WARNING("Le context ne sera pas traité car il existe déjà un autre context possédant le même nom !"); continue; } |
---|
| 35 | |
---|
| 36 | Context::SetCurrentContext(attributes["id"]); |
---|
[120] | 37 | Context& context = *Context::CreateObject(attributes["id"]); |
---|
[112] | 38 | |
---|
[123] | 39 | if (attributes.end() != attributes.find("calendar_type") && attributes.end() != attributes.find("start_date")) |
---|
| 40 | context.setCalendar(attributes["calendar_type"], attributes["start_date"]); |
---|
| 41 | |
---|
[112] | 42 | context.parse(_node); |
---|
| 43 | attributes.clear(); |
---|
| 44 | |
---|
| 45 | } while (_node.goToNextElement()); |
---|
| 46 | } |
---|
| 47 | }; // class XMLParser |
---|
[114] | 48 | } // namespace XML |
---|
[112] | 49 | |
---|
[114] | 50 | }// namespace XMLIOSERVER |
---|
[112] | 51 | |
---|
| 52 | |
---|
| 53 | #endif // __XMLIO_XML_PARSER__ |
---|
Note: See
TracBrowser
for help on using the repository browser.