fca73fa89f34e7d768001089cce94f7efa633e19
[metaproxy-moved-to-github.git] / src / xmlutil.hpp
1 /* $Id: xmlutil.hpp,v 1.4 2006-01-11 14:58:28 adam Exp $
2    Copyright (c) 2005, Index Data.
3
4 %LICENSE%
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 yp2 {
15     namespace xml {
16         std::string get_text(const xmlNode *ptr);
17         bool is_element(const xmlNode *ptr, 
18                         const std::string &ns,
19                         const std::string &name);
20         bool is_element_yp2(const xmlNode *ptr, const std::string &name);
21         bool check_element_yp2(const xmlNode *ptr, 
22                                const std::string &name);
23         std::string get_route(const xmlNode *node);
24
25         const xmlNode* jump_to(const xmlNode* node, int node_type);
26
27         const xmlNode* jump_to_next(const xmlNode* node, int node_type);
28         
29         const xmlNode* jump_to_children(const xmlNode* node, int node_type);
30
31         void check_empty(const xmlNode *node);
32
33     }
34     class XMLError : public std::runtime_error {
35     public:
36         XMLError(const std::string msg) :
37             std::runtime_error("XMLError : " + msg) {} ;
38     };
39 }
40
41 #endif
42 /*
43  * Local variables:
44  * c-basic-offset: 4
45  * indent-tabs-mode: nil
46  * c-file-style: "stroustrup"
47  * End:
48  * vim: shiftwidth=4 tabstop=8 expandtab
49  */