Changeset 111 for XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio_xml_node.hpp
- Timestamp:
- 06/21/10 15:06:43 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio_xml_node.hpp
r109 r111 11 11 #include <Poco/DOM/AutoPtr.h> 12 12 13 // Entêtes Poco SAX 13 // Entêtes Poco SAX. 14 14 #include <Poco/SAX/InputSource.h> 15 15 16 // Utilisation de la STL 16 // Utilisation de la STL. 17 17 using std::string; 18 18 … … 25 25 using std::ifstream; 26 26 27 // Utilisation de la biliothÚque POCO 27 // Utilisation de la biliothÚque POCO. 28 28 using Poco::XML::DOMParser; 29 29 using Poco::XML::InputSource; … … 64 64 // ... et à pour valeur la chaîne rootName. 65 65 node.pDoc = parser.parse(&src); 66 if (!(node.pDoc->documentElement()->nodeName().compare(_rootName))) 67 { node.setCNode(node.pDoc->documentElement()); } 68 else 69 throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + (node.pDoc->documentElement()->nodeName()) + "\" lue)"); 66 node.setCNode(node.pDoc->documentElement()); 67 if (node.getElementName().compare(_rootName) != 0) 68 throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)"); 70 69 } 71 70 else … … 75 74 } 76 75 77 string getElementName(void) const {return (this->getCNode()->nodeName());} 76 string getElementName(void) const 77 { string _str(this->getCNode()->nodeName()); return (_toLower(_str)); } 78 78 79 79 bool goToNextElement(void) … … 127 127 128 128 for(unsigned int i = 0; i< map->length(); i++) 129 attributes[map->item(i)->nodeName()] = map->item(i)->nodeValue(); 129 { 130 string _str(map->item(i)->nodeName()); 131 size_t d = map->item(i)->nodeValue().find_first_not_of (' '); 132 size_t f = map->item(i)->nodeValue().find_last_not_of (' '); 133 attributes[_toLower(_str)] = map->item(i)->nodeValue().substr(d,f-d+1); 134 } 130 135 131 136 return (true); … … 143 148 144 149 private : 150 151 string& _toLower(string& _str) const 152 { 153 for (unsigned int i = 0; i < _str.size(); i++) 154 _str[i] = tolower(_str[i]); 155 return (_str); 156 } 157 145 158 AutoPtr<Document> pDoc; 146 159 Node* cNode;
Note: See TracChangeset
for help on using the changeset viewer.