Changeset 126 for XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp
- Timestamp:
- 10/07/10 10:29:38 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp
r120 r126 12 12 { 13 13 public : 14 15 static XMLNode CreateNode(std::istream& _istr, const std::string& _rootName)16 {17 XMLNode node(_rootName);18 19 if (_istr.good())20 { // S'il est possible de lire le flux en entrée ...21 22 Poco::XML::InputSource src(_istr);23 Poco::XML::DOMParser parser;24 25 node.pDoc = parser.parse(&src);26 node.setCNode(node.pDoc->documentElement());27 if (node.getElementName().compare(_rootName) != 0) // << A passer en avertissement.28 throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)");29 }30 else31 throw XMLIOStreamException("Impossible de lire le flux en entrée pour le parsing XML !");32 33 return (node);34 }35 14 36 15 string getElementName(void) const … … 97 76 } 98 77 78 THashAttributes getAttributes(void) const // Idem que précédemment mais avec copie. 79 { THashAttributes __attributes; this->getAttributes(__attributes); return (__attributes); } 80 99 81 ~XMLNode() 100 82 { /* Ne rien faire de plus */ } 83 84 public : /* static */ 85 86 static XMLNode CreateNode(std::istream& _istr, const std::string& _rootName) 87 { 88 XMLNode node(_rootName); 89 90 if (_istr.good()) 91 { // S'il est possible de lire le flux en entrée ... 92 93 Poco::XML::InputSource src(_istr); 94 Poco::XML::DOMParser parser; 95 96 node.pDoc = parser.parse(&src); 97 node.setCNode(node.pDoc->documentElement()); 98 if (node.getElementName().compare(_rootName) != 0) // << A passer en avertissement. 99 throw XMLParsingException("L'élément racine doit avoir pour valeur <" + _rootName + "> (\"" + node.getElementName() + "\" lue)"); 100 } 101 else 102 throw XMLIOStreamException("Impossible de lire le flux en entrée pour le parsing XML !"); 103 104 return (node); 105 } 101 106 102 107 protected : … … 104 109 Poco::XML::Node * getCNode(void) const { return (this->cNode); } 105 110 void setCNode(Poco::XML::Node * _otherNode) { this->cNode = _otherNode; } 111 112 protected : /* static */ 106 113 107 114 static bool IsPtrNull(const Poco::XML::Node * const _ptr) { return (_ptr == NULL); } … … 120 127 121 128 Poco::XML::AutoPtr<Poco::XML::Document> pDoc; 122 Poco::XML::Node* 129 Poco::XML::Node* cNode; 123 130 124 131 string rootName;
Note: See TracChangeset
for help on using the changeset viewer.