|
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 <iostream>
|
|
|
18 |
#include <string>
|
|
|
19 |
|
|
|
20 |
#if !defined XMLPROCESSOR
|
|
|
21 |
#define XMLPROCESSOR
|
|
|
22 |
|
|
|
23 |
class XMLNode;
|
|
|
24 |
|
|
|
25 |
// T = ParserType : XMLSAXParser, XMLDOMParser etc.
|
|
|
26 |
template<typename T>
|
|
|
27 |
class XMLProcessor
|
|
|
28 |
{
|
|
|
29 |
public:
|
|
|
30 |
XMLProcessor() {
|
|
|
31 |
}
|
|
|
32 |
XMLProcessor(const std::string& x) {
|
|
|
33 |
xmlFile = x;
|
|
|
34 |
}
|
|
|
35 |
virtual ~XMLProcessor() {}
|
|
|
36 |
|
|
|
37 |
T& getParseEngine() { return parseEngine; }
|
|
|
38 |
|
|
|
39 |
XMLNode& getRootElement() { return parseEngine.getRootElement(); }
|
|
|
40 |
|
|
|
41 |
std::string& name() { return xmlFile; }
|
|
|
42 |
|
|
|
43 |
bool parse() { return parseEngine.parse(xmlFile); }
|
|
|
44 |
|
|
|
45 |
bool parse(const std::string& f) { return parseEngine.parse(f); }
|
|
|
46 |
|
|
|
47 |
void doValidation(bool v) { parseEngine.doValidation(v); }
|
|
|
48 |
void doSchema(bool s) { parseEngine.doSchema(s); }
|
|
|
49 |
void fullSchemaChecking(bool s) { parseEngine.fullSchemaChecking(s); }
|
|
|
50 |
void namespaces(bool n) { parseEngine.namespaces(n); }
|
|
|
51 |
|
|
|
52 |
private:
|
|
|
53 |
T parseEngine;
|
|
|
54 |
std::string xmlFile;
|
|
|
55 |
};
|
|
|
56 |
|
|
|
57 |
#endif // XMLPROCESSOR
|