! * Go to the end element tag of the current element * If the end of the document is reached, an error is raised. * \return false if end of document reached, otherwise true */
| 138 | * \return false if end of document reached, otherwise true |
| 139 | */ |
| 140 | bool XmlStreamReader::skipToEndElement() { |
| 141 | int depth = 1; |
| 142 | if (atEnd()) { |
| 143 | raiseError(i18n("unexpected end of document")); |
| 144 | return false; |
| 145 | } |
| 146 | |
| 147 | do { |
| 148 | readNext(); |
| 149 | if (isEndElement()) |
| 150 | depth--; |
| 151 | if (isStartElement()) |
| 152 | depth++; |
| 153 | } while (!((isEndElement() && depth == 0) || atEnd())); |
| 154 | |
| 155 | if (atEnd()) { |
| 156 | raiseError(i18n("unexpected end of document")); |
| 157 | return false; |
| 158 | } |
| 159 | |
| 160 | return true; |
| 161 | } |
| 162 | |
| 163 | /*! |
| 164 | * Read an XML attribute and convert it to int |