BOSS 8.0.0
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 ) { resetErrors(); }

◆ ~XmlErrorHandler()

XmlErrorHandler::~XmlErrorHandler ( )
inline

Definition at line 21 of file entity_test.cxx.

21{}

Member Function Documentation

◆ error()

void XmlErrorHandler::error ( const SAXParseException & exception)

Definition at line 155 of file entity_test.cxx.

155 {
156 char* charSyst = XMLString::transcode( toCatch.getSystemId() );
157 std::string systemId( charSyst );
158 XMLString::release( &charSyst );
159 char* charMsg = XMLString::transcode( toCatch.getMessage() );
160 std::string msg( charMsg );
161 XMLString::release( &charMsg );
162 m_nError++;
163 std::cerr << "Error at file \"" << systemId << "\", line " << toCatch.getLineNumber()
164 << ", column " << toCatch.getColumnNumber() << "\n Message: " << msg << "\n\n";
165}

◆ fatalError()

void XmlErrorHandler::fatalError ( const SAXParseException & exception)

Definition at line 167 of file entity_test.cxx.

167 {
168
169 // getMessage returns type XMLCh*
170 char* charMsg = XMLString::transcode( toCatch.getMessage() );
171 std::string msg( charMsg );
172 XMLString::release( &charMsg );
173 m_nFatal++;
174 if ( !( toCatch.getSystemId() ) )
175 {
176 std::cerr << "Fatal XML parse error: no such file "
177 << "\n Message: " << msg << "\n\n";
178 }
179 else
180 {
181 char* charSyst = XMLString::transcode( toCatch.getSystemId() );
182 std::string systemId( charSyst );
183 XMLString::release( &charSyst );
184 std::cerr << "Fatal error at file \"" << systemId << "\", line " << toCatch.getLineNumber()
185 << ", column " << toCatch.getColumnNumber() << "\n Message: " << msg << "\n\n";
186 }
187}

◆ getErrorCount()

int XmlErrorHandler::getErrorCount ( ) const
inline

Definition at line 28 of file entity_test.cxx.

28{ return m_nError; }

◆ getFatalCount()

int XmlErrorHandler::getFatalCount ( ) const
inline

Definition at line 29 of file entity_test.cxx.

29{ return m_nFatal; }

◆ getWarningCount()

int XmlErrorHandler::getWarningCount ( ) const
inline

Definition at line 27 of file entity_test.cxx.

27{ return m_nWarning; }

◆ resetErrors()

void XmlErrorHandler::resetErrors ( )

Definition at line 188 of file entity_test.cxx.

188{ m_nWarning = m_nError = m_nFatal = 0; }

Referenced by XmlErrorHandler().

◆ warning()

void XmlErrorHandler::warning ( const SAXParseException & exception)

Definition at line 153 of file entity_test.cxx.

153{ m_nWarning++; }

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