aboutsummaryrefslogtreecommitdiff
path: root/src/xmlreader.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/xmlreader.cpp38
1 files changed, 11 insertions, 27 deletions
diff --git a/src/xmlreader.cpp b/src/xmlreader.cpp
index bb24157..76c6258 100644
--- a/src/xmlreader.cpp
+++ b/src/xmlreader.cpp
@@ -1,10 +1,10 @@
1#include "xmlreader.h" 1#include "xmlreader.h"
2#include "xmlexception.h"
2#include <string.h> 3#include <string.h>
3 4
4XmlReader::XmlReader( bool bStrip ) 5XmlReader::XmlReader( bool bStrip ) :
6 bStrip( bStrip )
5{ 7{
6 nError = 0;
7 this->bStrip = bStrip;
8} 8}
9 9
10XmlReader::~XmlReader() 10XmlReader::~XmlReader()
@@ -68,13 +68,12 @@ bool XmlReader::node()
68 } 68 }
69 else 69 else
70 { 70 {
71 reportError("Close node in singleNode malformed!"); 71 throw XmlException("Close node in singleNode malformed!");
72 return false;
73 } 72 }
74 } 73 }
75 else 74 else
76 { 75 {
77 reportError("Close node expected, but not found."); 76 throw XmlException("Close node expected, but not found.");
78 return false; 77 return false;
79 } 78 }
80 79
@@ -108,8 +107,7 @@ bool XmlReader::startNode()
108 } 107 }
109 else 108 else
110 { 109 {
111 reportError("Got a mismatched node close tag."); 110 throw XmlException("Got a mismatched node close tag.");
112 return false;
113 } 111 }
114 } 112 }
115 else 113 else
@@ -127,8 +125,7 @@ bool XmlReader::startNode()
127 } 125 }
128 else 126 else
129 { 127 {
130 reportError("Got extra junk data instead of node close tag."); 128 throw XmlException("Got extra junk data instead of node close tag.");
131 return false;
132 } 129 }
133 } 130 }
134 else 131 else
@@ -146,8 +143,7 @@ bool XmlReader::startNode()
146 } 143 }
147 else 144 else
148 { 145 {
149 reportError("Expected to find node opening char, '<'.\n"); 146 throw XmlException("Expected to find node opening char, '<'.");
150 return false;
151 } 147 }
152 148
153 return true; 149 return true;
@@ -306,7 +302,7 @@ bool XmlReader::param()
306 } 302 }
307 else 303 else
308 { 304 {
309 reportError("Expected an equals to seperate the params."); 305 throw XmlException("Expected an equals to seperate the params.");
310 return false; 306 return false;
311 } 307 }
312 308
@@ -352,8 +348,7 @@ bool XmlReader::content()
352 } 348 }
353 else 349 else
354 { 350 {
355 reportError("Mismatched close tag found."); 351 throw XmlException("Mismatched close tag found: <%s> to <%s>.", getCurrent()->getName(), fbName.getData() );
356 return false;
357 } 352 }
358 } 353 }
359 else 354 else
@@ -370,8 +365,7 @@ bool XmlReader::content()
370 } 365 }
371 else 366 else
372 { 367 {
373 reportError("Malformed close tag."); 368 throw XmlException("Malformed close tag.");
374 return false;
375 } 369 }
376 } 370 }
377 else 371 else
@@ -400,13 +394,3 @@ bool XmlReader::content()
400 } 394 }
401} 395}
402 396
403void XmlReader::reportError( const char *sError )
404{
405 printf("XmlReader error: %s\n", sError );
406}
407
408int XmlReader::getError()
409{
410 return nError;
411}
412