Implement basic configuration of session_shared.
[metaproxy-moved-to-github.git] / src / xmlutil.hpp
1 /* $Id: xmlutil.hpp,v 1.8 2006-06-21 09:16:54 adam Exp $
2    Copyright (c) 2005-2006, Index Data.
3
4    See the LICENSE file for details
5  */
6
7 #ifndef XML_UTIL_HPP
8 #define XML_UTIL_HPP
9
10 #include <string>
11 #include <stdexcept>
12 #include <libxml/tree.h>
13
14 namespace metaproxy_1 {
15     namespace xml {
16         std::string get_text(const xmlNode *ptr);
17         bool get_bool(const xmlNode *ptr, bool default_value);
18         int get_int(const xmlNode *ptr, int default_value);
19         bool is_element(const xmlNode *ptr, 
20                         const std::string &ns,
21                         const std::string &name);
22         bool is_element_yp2(const xmlNode *ptr, const std::string &name);
23         bool check_element_yp2(const xmlNode *ptr, 
24                                const std::string &name);
25         std::string get_route(const xmlNode *node);
26
27         const xmlNode* jump_to(const xmlNode* node, int node_type);
28
29         const xmlNode* jump_to_next(const xmlNode* node, int node_type);
30         
31         const xmlNode* jump_to_children(const xmlNode* node, int node_type);
32
33         void check_empty(const xmlNode *node);
34
35     }
36     class XMLError : public std::runtime_error {
37     public:
38         XMLError(const std::string msg) :
39             std::runtime_error("XMLError : " + msg) {} ;
40     };
41 }
42
43 #endif
44 /*
45  * Local variables:
46  * c-basic-offset: 4
47  * indent-tabs-mode: nil
48  * c-file-style: "stroustrup"
49  * End:
50  * vim: shiftwidth=4 tabstop=8 expandtab
51  */