ANNA Suite  2020b
Multipurpose development suite for Telco applications
Parser.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_xml_Parser_hpp
10 #define anna_xml_Parser_hpp
11 
13 #include <anna/core/mt/Mutex.hpp>
14 
15 struct _xmlValidCtxt;
16 struct _xmlDoc;
17 struct _xmlNode;
18 struct _xmlAttr;
19 
20 namespace anna {
21 
22 class DataBlock;
23 
24 namespace xml {
25 
26 class Node;
27 class DTD;
28 class Document;
29 class Attribute;
30 
63 class Parser : public Mutex {
64 public:
68  Parser();
69 
73  virtual ~Parser();
74 
84  const Node* getRoot() const { return a_root; }
85 
95  const Node* apply(const Document& document) noexcept(false);
96 
111  const Node* apply(const Document& document, const DTD& dtd) noexcept(false);
112 
113 protected:
114  /*
115  * Nodo ráiz del árbol representado por el documento XML analizado.
116  */
118 
123  virtual void reset() ;
124 
128  void setupEncoding(_xmlDoc* document) ;
129 
136  const char* decode(const unsigned char* source) ;
137 
141  void attributes(Node* node, _xmlAttr* attribute) noexcept(false);
142 
146  void children(Node* node, _xmlNode* xmlNode) noexcept(false);
147 
148 private:
149  _xmlValidCtxt* a_context;
150  static char st_text [1024];
151  static anna::RuntimeException* st_exception;
152  bool a_encoding;
153  DataBlock* a_buffEncode;
154 
155  Parser(const Parser&);
156 
157  void apply(_xmlDoc* document) noexcept(false);
158 
159  static void errorHandler(void *ctx, const char *msg, ...) ;
160  static void warningHandler(void *ctx, const char *msg, ...) ;
161 };
162 
163 }
164 }
165 
166 #endif
const char * decode(const unsigned char *source)
virtual void reset()
Definition: Document.hpp:49
xml::Attribute Attribute
Definition: Attribute.hpp:21
const Node * getRoot() const
Definition: Parser.hpp:84
Definition: Node.hpp:56
Node * a_root
Definition: Parser.hpp:117
Definition: DTD.hpp:56
Definition: Parser.hpp:63
xml::Node Node
Definition: Node.hpp:21
Definition: app.hpp:12
void children(Node *node, _xmlNode *xmlNode) noexcept(false)
Definition: Mutex.hpp:41
const Node * apply(const Document &document) noexcept(false)
Definition: RuntimeException.hpp:23
void attributes(Node *node, _xmlAttr *attribute) noexcept(false)
Definition: DataBlock.hpp:24
void setupEncoding(_xmlDoc *document)