|
0
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* This component and the accompanying materials are made available
|
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
|
6 |
* which accompanies this distribution, and is available
|
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
|
8 |
*
|
|
|
9 |
* Initial Contributors:
|
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
|
11 |
*
|
|
|
12 |
* Contributors:
|
|
|
13 |
*
|
|
|
14 |
* Description:
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
#include <xercesc/sax/HandlerBase.hpp>
|
|
|
18 |
#include <xercesc/sax/AttributeList.hpp>
|
|
|
19 |
#include <xercesc/util/PlatformUtils.hpp>
|
|
|
20 |
#include <xercesc/sax/SAXParseException.hpp>
|
|
|
21 |
#include <xercesc/sax/SAXException.hpp>
|
|
|
22 |
#include <iostream>
|
|
|
23 |
using namespace std;
|
|
|
24 |
|
|
|
25 |
#if !defined XMLSAXERRORHANDLER
|
|
|
26 |
#define XMLSAXERRORHANDLER
|
|
|
27 |
|
|
|
28 |
class XMLSAXErrorHandler : public HandlerBase
|
|
|
29 |
{
|
|
|
30 |
public:
|
|
|
31 |
XMLSAXErrorHandler();
|
|
|
32 |
virtual ~XMLSAXErrorHandler();
|
|
|
33 |
|
|
|
34 |
// Handlers for the SAX ErrorHandler interface
|
|
|
35 |
virtual void warning(const SAXParseException& exception);
|
|
|
36 |
virtual void error(const SAXParseException& exception);
|
|
|
37 |
virtual void fatalError(const SAXParseException& exception);
|
|
|
38 |
};
|
|
|
39 |
|
|
|
40 |
// Empty default constructor
|
|
|
41 |
XMLSAXErrorHandler::XMLSAXErrorHandler()
|
|
|
42 |
{
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
// Empty default destructor
|
|
|
46 |
XMLSAXErrorHandler::~XMLSAXErrorHandler()
|
|
|
47 |
{
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
// Overrides of the SAX ErrorHandler interface
|
|
|
51 |
void XMLSAXErrorHandler::error(const SAXParseException& e)
|
|
|
52 |
{
|
|
|
53 |
std::cerr << endl << "Error at file " << XMLString::transcode(e.getSystemId())
|
|
|
54 |
<< ", line " << e.getLineNumber()
|
|
|
55 |
<< ", char " << e.getColumnNumber() << endl
|
|
|
56 |
<< " Message: " << XMLString::transcode(e.getMessage()) << endl;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
void XMLSAXErrorHandler::fatalError(const SAXParseException& e)
|
|
|
60 |
{
|
|
|
61 |
std::cerr << "\nFatal Error at file " << XMLString::transcode(e.getSystemId())
|
|
|
62 |
<< ", line " << e.getLineNumber()
|
|
|
63 |
<< ", char " << e.getColumnNumber()
|
|
|
64 |
<< "\n Message: " << XMLString::transcode(e.getMessage()) << endl;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
void XMLSAXErrorHandler::warning(const SAXParseException& e)
|
|
|
68 |
{
|
|
|
69 |
std::cerr << "\nWarning at file " << XMLString::transcode(e.getSystemId())
|
|
|
70 |
<< ", line " << e.getLineNumber()
|
|
|
71 |
<< ", char " << e.getColumnNumber()
|
|
|
72 |
<< "\n Message: " << XMLString::transcode(e.getMessage()) << endl;
|
|
|
73 |
}
|
|
|
74 |
#endif // XMLSAXERRORHANDLER
|
|
|
75 |
|