Separatista
documentreader.h
1 /***************************************************************************
2 * Copyright (C) 2014 by Okkel Klaver *
3 * info@vanhetland.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 
21 #include <vector>
22 #include <string>
23 
24 #include "separatista/separatista.h"
25 #include "separatista/xerces_types.h"
26 #include "separatista/element.h"
27 #include "separatista/separatistadocument.h"
28 
29 #ifndef SEPARATISTA_DOCUMENTREADER_H
30 #define SEPARATISTA_DOCUMENTREADER_H
31 
32 namespace Separatista
33 {
37  typedef struct
38  {
39  typedef enum
40  {
41  ETC_WARNING,
42  ETC_ERROR,
43  ETC_FATALERROR
44  } ErrorCode;
45  ErrorCode errorCode;
46  std::wstring msg;
47  } ErrorType;
48 
49  class SEPARATISTA_EXTERN DocumentReader
50  {
51  public:
53 
57  ~DocumentReader();
58 
60  int getErrorCount() const;
61 
63  const ErrorType::ErrorCode getErrorCode(int index) const;
64 
66  const wchar_t* getErrorMessage(int index) const;
67 
69  void warning(const xercesc::SAXParseException &e);
70 
72  void error(const xercesc::SAXParseException &e);
73 
75  void fatalError(const xercesc::SAXParseException &e);
76 
78  void resetErrors();
79 
86  IOErrorCode loadSchema(const wchar_t *pNameSpace);
87 
91  IOErrorCode parseFile(const wchar_t *pPath);
92 
99  SeparatistaDocument* getDocument(bool bWithAutoMagic = true);
100 
101  protected:
102  void appendError(ErrorType::ErrorCode etc, const xercesc::SAXParseException &e);
103 
104  private:
105  xercesc::XercesDOMParser *m_pParser;
106  xercesc::DOMDocument *m_pDocument;
107  std::vector<ErrorType*> m_ErrorList;
108  };
109 }
110 
111 #endif // SEPARATISTA_DOCUMENTREADER_H
Definition: documentreader.h:49
Definition: documentreader.h:37
Definition: separatistadocument.h:35
Definition: mt940s.h:39