blob: 7bb9109fc7a1358f4a3f1e48f2273931e5f3017d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#ifndef NULLSOFT_XML_XMLREADER_H
#define NULLSOFT_XML_XMLREADER_H
#include "obj_xml.h"
#include <vector>
#include "expat.h"
#include "../WAT/WAT.h"
struct CallbackStruct
{
CallbackStruct(ifc_xmlreadercallback* _callback, const wchar_t* _match, bool doUpper);
CallbackStruct();
~CallbackStruct();
ifc_xmlreadercallback* callback;
wchar_t* match;
};
class XMLReader : public obj_xml
{
public:
XMLReader();
~XMLReader();
void RegisterCallback(const wchar_t* matchstr, ifc_xmlreadercallback* callback);
void UnregisterCallback(ifc_xmlreadercallback* callback);
int Open();
int OpenNamespace();
void OldFeed(void* data, size_t dataSize);
int Feed(void* data, size_t dataSize);
void Close();
void PushContext();
void PopContext();
void Reset();
void SetEncoding(const wchar_t* encoding);
int SetCaseSensitive();
protected:
RECVS_DISPATCH;
public:
void XMLCALL StartTag(const wchar_t* name, const wchar_t** atts);
void XMLCALL EndTag(const wchar_t* name);
void XMLCALL TextHandler(const wchar_t* s, int len);
void XMLCALL StartTag(const char* name, const char** atts);
void XMLCALL EndTag(const char* name);
void XMLCALL TextHandler(const char* s, int len);
private:
const wchar_t* BuildPath();
const wchar_t* AddPath(const wchar_t* node);
const wchar_t* AddPath(const char* node);
const wchar_t* RemovePath(const wchar_t* node);
const wchar_t* RemovePath(const char* node);
std::wstring pathString;//, pathUpper;
std::wstring endPathString;//, endPathUpper;
std::wstring currentNode;
private:
std::vector<CallbackStruct*> callbacks;
std::vector<XML_Parser> context;
XML_Parser parser;
bool case_sensitive;
std::wstring textCache;
};
#endif
|