0fe0878467071cef85897a02c64e6bdf10330be0
[metaproxy-moved-to-github.git] / src / xmlutil.hpp
1 /* $Id: xmlutil.hpp,v 1.10 2006-12-01 12:37:26 marc 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 struct _xmlAttr *ptr);
17         std::string get_text(const xmlNode *ptr);
18         bool get_bool(const xmlNode *ptr, bool default_value);
19         int get_int(const xmlNode *ptr, int default_value);
20         bool check_attribute(const _xmlAttr *ptr, 
21                         const std::string &ns,
22                         const std::string &name);
23         bool is_attribute(const _xmlAttr *ptr, 
24                         const std::string &ns,
25                         const std::string &name);
26         bool is_element(const xmlNode *ptr, 
27                         const std::string &ns,
28                         const std::string &name);
29         bool is_element_mp(const xmlNode *ptr, const std::string &name);
30         bool check_element_mp(const xmlNode *ptr, 
31                                const std::string &name);
32         std::string get_route(const xmlNode *node);
33
34         const xmlNode* jump_to(const xmlNode* node, int node_type);
35
36         const xmlNode* jump_to_next(const xmlNode* node, int node_type);
37         
38         const xmlNode* jump_to_children(const xmlNode* node, int node_type);
39
40         void check_empty(const xmlNode *node);
41
42     }
43     class XMLError : public std::runtime_error {
44     public:
45         XMLError(const std::string msg) :
46             std::runtime_error("XMLError : " + msg) {} ;
47     };
48 }
49
50 #endif
51 /*
52  * Local variables:
53  * c-basic-offset: 4
54  * indent-tabs-mode: nil
55  * c-file-style: "stroustrup"
56  * End:
57  * vim: shiftwidth=4 tabstop=8 expandtab
58  */