]> git.evergreen-ils.org Git - OpenSRF.git/blob - include/opensrf/xml_utils.h
Prepare for #inclusion in C++
[OpenSRF.git] / include / opensrf / xml_utils.h
1 #ifndef XML_UTILS_H
2 #define XML_UTILS_H
3
4 #include <opensrf/osrf_json.h>
5 #include <libxml/parser.h>
6 #include <libxml/tree.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 jsonObject* xmlDocToJSON(xmlDocPtr doc);
13
14 /* debug function, prints each node and content */
15 void recurse_doc( xmlNodePtr node );
16
17
18 /* turns an XML doc into a char*.  
19         User is responsible for freeing the returned char*
20         if(full), then we return the whole doc (xml declaration, etc.)
21         else we return the doc from the root node down
22         */
23 char* xmlDocToString(xmlDocPtr doc, int full);
24
25
26 /* Takes an xmlChar** from a SAX callback and returns the value
27         for the attribute with name 'name'
28         */
29 char* xmlSaxAttr( const xmlChar** atts, const char* name ); 
30
31 /**
32   Sets the xml attributes from atts to the given dom node 
33  */
34 int xmlAddAttrs( xmlNodePtr node, const xmlChar** atts );
35
36 #ifdef __cplusplus
37 }
38 #endif
39
40 #endif