BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
XmlErrorHandler Class Reference
+ Inheritance diagram for XmlErrorHandler:

Public Member Functions

 XmlErrorHandler (std::ostream &errOut=std::cerr)
 
 ~XmlErrorHandler ()
 
void warning (const SAXParseException &exception)
 
void error (const SAXParseException &exception)
 
void fatalError (const SAXParseException &exception)
 
void resetErrors ()
 
int getWarningCount () const
 
int getErrorCount () const
 
int getFatalCount () const
 

Detailed Description

Definition at line 18 of file entity_test.cxx.

Constructor & Destructor Documentation

◆ XmlErrorHandler()

XmlErrorHandler::XmlErrorHandler ( std::ostream &  errOut = std::cerr)
inline

Definition at line 20 of file entity_test.cxx.

20 : m_errOut(errOut)
21 {resetErrors();}

◆ ~XmlErrorHandler()

XmlErrorHandler::~XmlErrorHandler ( )
inline

Definition at line 22 of file entity_test.cxx.

22{}

Member Function Documentation

◆ error()

void XmlErrorHandler::error ( const SAXParseException &  exception)

Definition at line 166 of file entity_test.cxx.

166 {
167 char* charSyst = XMLString::transcode(toCatch.getSystemId());
168 std::string systemId(charSyst);
169 XMLString::release(&charSyst);
170 char* charMsg = XMLString::transcode(toCatch.getMessage());
171 std::string msg(charMsg);
172 XMLString::release(&charMsg);
173 m_nError++;
174 std::cerr << "Error at file \"" << systemId
175 << "\", line " << toCatch.getLineNumber()
176 << ", column " << toCatch.getColumnNumber()
177 << "\n Message: " << msg << "\n\n";
178}

◆ fatalError()

void XmlErrorHandler::fatalError ( const SAXParseException &  exception)

Definition at line 180 of file entity_test.cxx.

180 {
181
182 // getMessage returns type XMLCh*
183 char* charMsg = XMLString::transcode(toCatch.getMessage());
184 std::string msg(charMsg);
185 XMLString::release(&charMsg);
186 m_nFatal++;
187 if (!(toCatch.getSystemId()) ) {
188 std::cerr << "Fatal XML parse error: no such file "
189 << "\n Message: " << msg << "\n\n";
190 }
191 else {
192 char* charSyst = XMLString::transcode(toCatch.getSystemId());
193 std::string systemId(charSyst);
194 XMLString::release(&charSyst);
195 std::cerr << "Fatal error at file \""
196 << systemId
197 << "\", line " << toCatch.getLineNumber()
198 << ", column " << toCatch.getColumnNumber()
199 << "\n Message: " << msg << "\n\n";
200 }
201}

◆ getErrorCount()

int XmlErrorHandler::getErrorCount ( ) const
inline

Definition at line 29 of file entity_test.cxx.

29{return m_nError;}

◆ getFatalCount()

int XmlErrorHandler::getFatalCount ( ) const
inline

Definition at line 30 of file entity_test.cxx.

30{return m_nFatal;}

◆ getWarningCount()

int XmlErrorHandler::getWarningCount ( ) const
inline

Definition at line 28 of file entity_test.cxx.

28{return m_nWarning;}

◆ resetErrors()

void XmlErrorHandler::resetErrors ( )

Definition at line 202 of file entity_test.cxx.

202 {
203 m_nWarning = m_nError = m_nFatal = 0;
204}

Referenced by XmlErrorHandler().

◆ warning()

void XmlErrorHandler::warning ( const SAXParseException &  exception)

Definition at line 162 of file entity_test.cxx.

162 {
163 m_nWarning++;
164}

The documentation for this class was generated from the following file: