]> git.evergreen-ils.org Git - OpenSRF.git/blob - include/opensrf/xml_utils.h
Merging changes from branches/new-json2
[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 jsonObject* xmlDocToJSON(xmlDocPtr doc);
9
10 /* helper function */
11 jsonObject* _xmlToJSON(xmlNodePtr node, jsonObject*);
12
13 /* debug function, prints each node and content */
14 void recurse_doc( xmlNodePtr node );
15
16
17 /* turns an XML doc into a char*.  
18         User is responsible for freeing the returned char*
19         if(full), then we return the whole doc (xml declaration, etc.)
20         else we return the doc from the root node down
21         */
22 char* xmlDocToString(xmlDocPtr doc, int full);
23
24
25 /* Takes an xmlChar** from a SAX callback and returns the value
26         for the attribute with name 'name'
27         */
28 char* xmlSaxAttr( const xmlChar** atts, char* name ); 
29
30 /**
31   Sets the xml attributes from atts to the given dom node 
32  */
33 int xmlAddAttrs( xmlNodePtr node, const xmlChar** atts );
34
35
36 #endif