27d95af3dcd160e70b70632365e9c9dfc387de8a
[metaproxy-moved-to-github.git] / src / xmlutil.hpp
1 /* $Id: xmlutil.hpp,v 1.7 2006-06-19 13:08:00 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         bool is_element(const xmlNode *ptr, 
19                         const std::string &ns,
20                         const std::string &name);
21         bool is_element_yp2(const xmlNode *ptr, const std::string &name);
22         bool check_element_yp2(const xmlNode *ptr, 
23                                const std::string &name);
24         std::string get_route(const xmlNode *node);
25
26         const xmlNode* jump_to(const xmlNode* node, int node_type);
27
28         const xmlNode* jump_to_next(const xmlNode* node, int node_type);
29         
30         const xmlNode* jump_to_children(const xmlNode* node, int node_type);
31
32         void check_empty(const xmlNode *node);
33
34     }
35     class XMLError : public std::runtime_error {
36     public:
37         XMLError(const std::string msg) :
38             std::runtime_error("XMLError : " + msg) {} ;
39     };
40 }
41
42 #endif
43 /*
44  * Local variables:
45  * c-basic-offset: 4
46  * indent-tabs-mode: nil
47  * c-file-style: "stroustrup"
48  * End:
49  * vim: shiftwidth=4 tabstop=8 expandtab
50  */