21#define APR_WANT_STRFUNC
26#include "apu_config.h"
28#if defined(HAVE_XMLPARSE_XMLPARSE_H)
29#include <xmlparse/xmlparse.h>
30#elif defined(HAVE_XMLTOK_XMLPARSE_H)
31#include <xmltok/xmlparse.h>
32#elif defined(HAVE_XML_XMLPARSE_H)
33#include <xml/xmlparse.h>
38#define DEBUG_CR "\r\n"
40static const char APR_KW_xmlns[] = { 0x78, 0x6D, 0x6C, 0x6E, 0x73,
'\0' };
41static const char APR_KW_xmlns_lang[] = { 0x78, 0x6D, 0x6C, 0x3A, 0x6C, 0x61, 0x6E, 0x67,
'\0' };
42static const char APR_KW_DAV[] = { 0x44, 0x41, 0x56, 0x3A,
'\0' };
45#define APR_XML_NS_ERROR_UNKNOWN_PREFIX (-1000)
46#define APR_XML_NS_ERROR_INVALID_DECL (-1001)
49#define APR_XML_NS_IS_RESERVED(name) \
50 ( (name[0] == 0x58 || name[0] == 0x78) && \
51 (name[1] == 0x4D || name[1] == 0x6D) && \
52 (name[2] == 0x4C || name[2] == 0x6C) )
62#define APR_XML_ERROR_EXPAT 1
63#define APR_XML_ERROR_PARSE_DONE 2
91 for (ns_scope =
elem->ns_scope; ns_scope; ns_scope = ns_scope->
next) {
133 for (; ns_scope; ns_scope = ns_scope->
next) {
134 if (ns_scope->
ns ==
ns)
181 if (
elem->parent->last_child ==
NULL) {
183 elem->parent->first_child =
elem->parent->last_child =
elem;
187 elem->parent->last_child->next =
elem;
207 if (
attr->value[0] ==
'\0') {
213 else if (*
prefix !=
'\0') {
228 elem->ns_scope = ns_scope;
296 char *attr_name = (
char *)
attr->name;
354 hdr = &
elem->last_child->following_cdata;
370#if XML_MAJOR_VERSION > 1
421#if XML_MAJOR_VERSION > 1
489 msg =
"An undefined namespace prefix was used.";
493 msg =
"A namespace prefix was defined with an empty URI.";
498 "XML parser error code: %s (%d)",
503 msg =
"The parser is not active.";
507 msg =
"There was an unknown error within the XML body.";
598 if (
c ==
'<' ||
c ==
'>')
649#define APR_XML_NS_LEN(ns) ((ns) < 10 ? 1 : (ns) < 100 ? 2 : (ns) < 1000 ? 3 : \
650 (ns) < 10000 ? 4 : (ns) < 100000 ? 5 : \
651 (ns) < 1000000 ? 6 : (ns) < 10000000 ? 7 : \
652 (ns) < 100000000 ? 8 : (ns) < 1000000000 ? 9 : 10)
658 for (;
t;
t =
t->next)
659 size += strlen(
t->text);
690 size += 11 + strlen(
elem->lang) + 1;
697 for (; ns_scope; ns_scope = ns_scope->
next) {
704 size += 11 + strlen(
elem->lang) + 1;
739 size += 1 + strlen(
attr->name) + 2 + strlen(
attr->value) + 1;
761 size += 11 + strlen(
elem->lang) + 1;
787 for (;
t;
t =
t->next) {
834 elem->lang !=
elem->parent->lang)) {
852 for (; ns_scope; ns_scope = ns_scope->
next) {
884 for (child =
elem->first_child; child; child = child->
next) {
993#if APR_CHARSET_EBCDIC
1009 for (
t =
e->first_cdata.first;
t !=
NULL;
t =
t->next) {
1017 for (
t =
e->following_cdata.first;
t !=
NULL;
t =
t->next) {
1038 for (ec =
e->first_child; ec !=
NULL; ec = ec->
next) {
const char apr_size_t len
const ap_regex_t char * errbuf
APR Standard Headers Support.
static int find_prefix(apr_xml_parser *parser, const char *prefix)
static apr_size_t elem_size(const apr_xml_elem *elem, int style, apr_array_header_t *namespaces, int *ns_map)
static apr_size_t text_size(const apr_text *t)
static const char APR_KW_xmlns_lang[]
#define APR_XML_ERROR_EXPAT
static void start_handler(void *userdata, const char *name, const char **attrs)
static apr_status_t do_parse(apr_xml_parser *parser, const char *data, apr_size_t len, int is_final)
static char * write_elem(char *s, const apr_xml_elem *elem, int style, apr_array_header_t *namespaces, int *ns_map)
static const char * find_prefix_name(const apr_xml_elem *elem, int ns, int parent)
#define APR_XML_NS_ERROR_INVALID_DECL
static void default_handler(void *userData, const XML_Char *s, int len)
#define APR_XML_NS_LEN(ns)
static apr_status_t cleanup_parser(void *ctx)
#define APR_XML_NS_IS_RESERVED(name)
static char * write_text(char *s, const apr_text *t)
static void cdata_handler(void *userdata, const char *data, int len)
static void end_handler(void *userdata, const char *name)
#define APR_XML_ERROR_PARSE_DONE
static const char APR_KW_DAV[]
static const char APR_KW_xmlns[]
#define APR_XML_NS_ERROR_UNKNOWN_PREFIX
const XML_LChar * XML_ErrorString(enum XML_Error code)
void XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)
void XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler)
void XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler)
enum XML_Status XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
enum XML_Status XML_StopParser(XML_Parser parser, XML_Bool resumable)
enum XML_Error XML_GetErrorCode(XML_Parser parser)
XML_Parser XML_ParserCreate(const XML_Char *encoding)
void XML_ParserFree(XML_Parser parser)
void XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler)
void XML_SetUserData(XML_Parser parser, void *userData)
apr_brigade_flush void * ctx
apr_bucket apr_bucket_brigade * a
apr_pool_t const char apr_dbd_t const char ** error
int char apr_size_t errbufsize
APU_DECLARE(void)
Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...
const void apr_size_t int colon
const apr_xml_elem int apr_array_header_t int const char apr_size_t * psize
#define APR_XML_X2T_PARSED
const apr_xml_elem int apr_array_header_t int * ns_map
#define APR_XML_X2T_LANG_INNER
#define APR_XML_NS_IS_ERROR(e)
apr_xml_parser apr_xml_doc ** ppdoc
apr_text_header const char * text
#define APR_XML_X2T_FULL_NS_LANG
#define APR_XML_ELEM_IS_EMPTY(e)
const apr_xml_elem int style
const apr_xml_elem int apr_array_header_t int const char ** pbuf
apr_xml_parser apr_xml_doc apr_file_t * xmlfd
apr_xml_parser apr_xml_doc apr_file_t apr_size_t buffer_length
#define APR_XML_GET_URI_ITEM(ary, i)
const apr_xml_elem int apr_array_header_t * namespaces
struct apr_xlate_t apr_xlate_t
const char apr_size_t * inbytes_left
const char apr_size_t char apr_size_t * outbytes_left
const char int apr_pool_t * pool
apr_vformatter_buff_t * c
#define apr_pcalloc(p, size)
const char const char *const const char *const apr_procattr_t * attr
struct apr_bucket *volatile next
struct apr_xml_attr * next
apr_array_header_t * namespaces
struct apr_xml_elem * parent
struct apr_xml_elem * next
apr_text_header following_cdata
struct apr_xml_ns_scope * next