00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00019
#ifndef APR_XML_H
00020
#define APR_XML_H
00021
00027
#include "apr_pools.h"
00028
#include "apr_tables.h"
00029
#include "apr_file_io.h"
00030
00031
#include "apu.h"
00032
00033
#ifdef __cplusplus
00034
extern "C" {
00035
#endif
00036
00041
00042
00043
00044
00046 typedef struct apr_text apr_text;
00047
00049 struct apr_text {
00051 const char *
text;
00053 struct apr_text *
next;
00054 };
00055
00057 typedef struct apr_text_header apr_text_header;
00058
00060 struct apr_text_header {
00062 apr_text *
first;
00064 apr_text *
last;
00065 };
00066
00073
APU_DECLARE(
void) apr_text_append(apr_pool_t *p, apr_text_header *hdr,
00074 const
char *text);
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 #define APR_XML_NS_DAV_ID 0
00130 #define APR_XML_NS_NONE -10
00132 #define APR_XML_NS_ERROR_BASE -100
00134 #define APR_XML_NS_IS_ERROR(e) ((e) <= APR_XML_NS_ERROR_BASE)
00135
00137 typedef struct
apr_xml_attr apr_xml_attr;
00139 typedef struct
apr_xml_elem apr_xml_elem;
00141 typedef struct
apr_xml_doc apr_xml_doc;
00142
00144 struct apr_xml_attr {
00146 const char *name;
00148 int ns;
00149
00151 const char *value;
00152
00154 struct apr_xml_attr *next;
00155 };
00156
00158 struct apr_xml_elem {
00160 const char *
name;
00162 int ns;
00164 const char *
lang;
00165
00167 apr_text_header first_cdata;
00169 apr_text_header following_cdata;
00170
00172 struct apr_xml_elem *
parent;
00174 struct apr_xml_elem *
next;
00176 struct apr_xml_elem *
first_child;
00178 struct apr_xml_attr *
attr;
00179
00180
00182 struct apr_xml_elem *
last_child;
00184 struct apr_xml_ns_scope *
ns_scope;
00185
00186
00188 void *
priv;
00189 };
00190
00192 #define APR_XML_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \
00193
(e)->first_cdata.first == NULL)
00194
00196 struct apr_xml_doc {
00198 apr_xml_elem *
root;
00200 apr_array_header_t *
namespaces;
00201 };
00202
00204 typedef struct apr_xml_parser apr_xml_parser;
00205
00211
APU_DECLARE(apr_xml_parser *) apr_xml_parser_create(apr_pool_t *pool);
00212
00223 APU_DECLARE(apr_status_t) apr_xml_parse_file(apr_pool_t *p,
00224 apr_xml_parser **parser,
00225
apr_xml_doc **ppdoc,
00226 apr_file_t *xmlfd,
00227 apr_size_t buffer_length);
00228
00229
00238 APU_DECLARE(apr_status_t) apr_xml_parser_feed(apr_xml_parser *parser,
00239 const
char *data,
00240 apr_size_t len);
00241
00250 APU_DECLARE(apr_status_t) apr_xml_parser_done(apr_xml_parser *parser,
00251
apr_xml_doc **pdoc);
00252
00260 APU_DECLARE(
char *) apr_xml_parser_geterror(apr_xml_parser *parser,
00261
char *errbuf,
00262 apr_size_t errbufsize);
00263
00264
00281 APU_DECLARE(
void) apr_xml_to_text(apr_pool_t *p, const
apr_xml_elem *elem,
00282
int style, apr_array_header_t *namespaces,
00283
int *ns_map, const
char **pbuf,
00284 apr_size_t *psize);
00285
00286
00287 #define APR_XML_X2T_FULL 0
00288 #define APR_XML_X2T_INNER 1
00289 #define APR_XML_X2T_LANG_INNER 2
00290 #define APR_XML_X2T_FULL_NS_LANG 3
00298 APU_DECLARE(const
char *) apr_xml_empty_elem(apr_pool_t *p,
00299 const
apr_xml_elem *elem);
00300
00311 APU_DECLARE(const
char *) apr_xml_quote_string(apr_pool_t *p, const
char *s,
00312
int quotes);
00313
00319 APU_DECLARE(
void) apr_xml_quote_elem(apr_pool_t *p,
apr_xml_elem *elem);
00320
00321
00322
00329 APU_DECLARE(
int) apr_xml_insert_uri(apr_array_header_t *uri_array,
00330 const
char *uri);
00331
00333 #define APR_XML_GET_URI_ITEM(ary, i) (((const
char * const *)(ary)->elts)[i])
00334
00335 #ifdef __cplusplus
00336 }
00337 #endif
00339 #endif