OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef XFA_SRC_FGAS_XML_FGAS_SAX_H_ | |
8 #define XFA_SRC_FGAS_XML_FGAS_SAX_H_ | |
9 | |
10 #include "core/include/fxcrt/fx_basic.h" | |
11 | |
12 #define FX_SAXPARSEMODE_NotConvert_amp 0x0001 | |
13 #define FX_SAXPARSEMODE_NotConvert_lt 0x0002 | |
14 #define FX_SAXPARSEMODE_NotConvert_gt 0x0004 | |
15 #define FX_SAXPARSEMODE_NotConvert_apos 0x0008 | |
16 #define FX_SAXPARSEMODE_NotConvert_quot 0x0010 | |
17 #define FX_SAXPARSEMODE_NotConvert_sharp 0x0020 | |
18 #define FX_SAXPARSEMODE_NotSkipSpace 0x0100 | |
19 | |
20 enum FX_SAXNODE { | |
21 FX_SAXNODE_Unknown = 0, | |
22 FX_SAXNODE_Instruction, | |
23 FX_SAXNODE_Declaration, | |
24 FX_SAXNODE_Comment, | |
25 FX_SAXNODE_Tag, | |
26 FX_SAXNODE_Text, | |
27 FX_SAXNODE_CharData, | |
28 }; | |
29 | |
30 class IFX_SAXReaderHandler { | |
31 public: | |
32 virtual ~IFX_SAXReaderHandler() {} | |
33 virtual void* OnTagEnter(const CFX_ByteStringC& bsTagName, | |
34 FX_SAXNODE eType, | |
35 FX_DWORD dwStartPos) = 0; | |
36 virtual void OnTagAttribute(void* pTag, | |
37 const CFX_ByteStringC& bsAttri, | |
38 const CFX_ByteStringC& bsValue) = 0; | |
39 virtual void OnTagBreak(void* pTag) = 0; | |
40 virtual void OnTagData(void* pTag, | |
41 FX_SAXNODE eType, | |
42 const CFX_ByteStringC& bsData, | |
43 FX_DWORD dwStartPos) = 0; | |
44 virtual void OnTagClose(void* pTag, FX_DWORD dwEndPos) = 0; | |
45 virtual void OnTagEnd(void* pTag, | |
46 const CFX_ByteStringC& bsTagName, | |
47 FX_DWORD dwEndPos) = 0; | |
48 virtual void OnTargetData(void* pTag, | |
49 FX_SAXNODE eType, | |
50 const CFX_ByteStringC& bsData, | |
51 FX_DWORD dwStartPos) = 0; | |
52 }; | |
53 | |
54 class IFX_SAXReader { | |
55 public: | |
56 virtual ~IFX_SAXReader() {} | |
57 virtual void Release() = 0; | |
58 virtual int32_t StartParse(IFX_FileRead* pFile, | |
59 FX_DWORD dwStart = 0, | |
60 FX_DWORD dwLen = -1, | |
61 FX_DWORD dwParseMode = 0) = 0; | |
62 virtual int32_t ContinueParse(IFX_Pause* pPause = NULL) = 0; | |
63 virtual void SkipCurrentNode() = 0; | |
64 virtual void SetHandler(IFX_SAXReaderHandler* pHandler) = 0; | |
65 }; | |
66 IFX_SAXReader* FX_SAXReader_Create(); | |
67 | |
68 #endif // XFA_SRC_FGAS_XML_FGAS_SAX_H_ | |
OLD | NEW |