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 #if APR_CHARSET_EBCDIC
00033 #include "apr_xlate.h"
00034 #endif
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00044
00045
00046
00047
00049 typedef struct apr_text apr_text;
00050
00052 struct apr_text {
00054 const char *text;
00056 struct apr_text *next;
00057 };
00058
00060 typedef struct apr_text_header apr_text_header;
00061
00063 struct apr_text_header {
00065 apr_text *first;
00067 apr_text *last;
00068 };
00069
00076 APU_DECLARE(void) apr_text_append(apr_pool_t *p, apr_text_header *hdr,
00077 const char *text);
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
00130
00131
00132 #define APR_XML_NS_DAV_ID 0
00133 #define APR_XML_NS_NONE -10
00135 #define APR_XML_NS_ERROR_BASE -100
00137 #define APR_XML_NS_IS_ERROR(e) ((e) <= APR_XML_NS_ERROR_BASE)
00138
00140 typedef struct apr_xml_attr apr_xml_attr;
00142 typedef struct apr_xml_elem apr_xml_elem;
00144 typedef struct apr_xml_doc apr_xml_doc;
00145
00147 struct apr_xml_attr {
00149 const char *name;
00151 int ns;
00152
00154 const char *value;
00155
00157 struct apr_xml_attr *next;
00158 };
00159
00161 struct apr_xml_elem {
00163 const char *name;
00165 int ns;
00167 const char *lang;
00168
00170 apr_text_header first_cdata;
00172 apr_text_header following_cdata;
00173
00175 struct apr_xml_elem *parent;
00177 struct apr_xml_elem *next;
00179 struct apr_xml_elem *first_child;
00181 struct apr_xml_attr *attr;
00182
00183
00185 struct apr_xml_elem *last_child;
00187 struct apr_xml_ns_scope *ns_scope;
00188
00189
00191 void *priv;
00192 };
00193
00195 #define APR_XML_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \
00196 (e)->first_cdata.first == NULL)
00197
00199 struct apr_xml_doc {
00201 apr_xml_elem *root;
00203 apr_array_header_t *namespaces;
00204 };
00205
00207 typedef struct apr_xml_parser apr_xml_parser;
00208
00214 APU_DECLARE(apr_xml_parser *) apr_xml_parser_create(apr_pool_t *pool);
00215
00226 APU_DECLARE(apr_status_t) apr_xml_parse_file(apr_pool_t *p,
00227 apr_xml_parser **parser,
00228 apr_xml_doc **ppdoc,
00229 apr_file_t *xmlfd,
00230 apr_size_t buffer_length);
00231
00232
00241 APU_DECLARE(apr_status_t) apr_xml_parser_feed(apr_xml_parser *parser,
00242 const char *data,
00243 apr_size_t len);
00244
00253 APU_DECLARE(apr_status_t) apr_xml_parser_done(apr_xml_parser *parser,
00254 apr_xml_doc **pdoc);
00255
00263 APU_DECLARE(char *) apr_xml_parser_geterror(apr_xml_parser *parser,
00264 char *errbuf,
00265 apr_size_t errbufsize);
00266
00267
00284 APU_DECLARE(void) apr_xml_to_text(apr_pool_t *p, const apr_xml_elem *elem,
00285 int style, apr_array_header_t *namespaces,
00286 int *ns_map, const char **pbuf,
00287 apr_size_t *psize);
00288
00289
00290 #define APR_XML_X2T_FULL 0
00291 #define APR_XML_X2T_INNER 1
00292 #define APR_XML_X2T_LANG_INNER 2
00293 #define APR_XML_X2T_FULL_NS_LANG 3
00301 APU_DECLARE(const char *) apr_xml_empty_elem(apr_pool_t *p,
00302 const apr_xml_elem *elem);
00303
00314 APU_DECLARE(const char *) apr_xml_quote_string(apr_pool_t *p, const char *s,
00315 int quotes);
00316
00322 APU_DECLARE(void) apr_xml_quote_elem(apr_pool_t *p, apr_xml_elem *elem);
00323
00324
00325
00332 APU_DECLARE(int) apr_xml_insert_uri(apr_array_header_t *uri_array,
00333 const char *uri);
00334
00336 #define APR_XML_GET_URI_ITEM(ary, i) (((const char * const *)(ary)->elts)[i])
00337
00338 #if APR_CHARSET_EBCDIC
00346 APU_DECLARE(apr_status_t) apr_xml_parser_convert_doc(apr_pool_t *p,
00347 apr_xml_doc *pdoc,
00348 apr_xlate_t *convset);
00349 #endif
00350
00351 #ifdef __cplusplus
00352 }
00353 #endif
00355 #endif