static svn_error_t * end_element(svn_ra_serf__xml_parser_t *parser, void *userData, svn_ra_serf__dav_props_t name) { mergeinfo_context_t *mergeinfo_ctx = userData; mergeinfo_state_e state; state = parser->state->current_state; if (state == MERGEINFO_REPORT && strcmp(name.name, SVN_DAV__MERGEINFO_REPORT) == 0) { svn_ra_serf__xml_pop_state(parser); } else if (state == MERGEINFO_ITEM && strcmp(name.name, SVN_DAV__MERGEINFO_ITEM) == 0) { if (mergeinfo_ctx->curr_info && mergeinfo_ctx->curr_path) { svn_mergeinfo_t path_mergeinfo; const char *path; SVN_ERR_ASSERT(mergeinfo_ctx->curr_path->data); path = apr_pstrdup(mergeinfo_ctx->pool, mergeinfo_ctx->curr_path->data); SVN_ERR(svn_mergeinfo_parse(&path_mergeinfo, mergeinfo_ctx->curr_info->data, mergeinfo_ctx->pool)); /* Correct for naughty servers that send "relative" paths with leading slashes! */ apr_hash_set(mergeinfo_ctx->result_catalog, path[0] == '/' ? path + 1 : path, APR_HASH_KEY_STRING, path_mergeinfo); } svn_ra_serf__xml_pop_state(parser); } else if (state == MERGEINFO_PATH && strcmp(name.name, SVN_DAV__MERGEINFO_PATH) == 0) { svn_ra_serf__xml_pop_state(parser); } else if (state == MERGEINFO_INFO && strcmp(name.name, SVN_DAV__MERGEINFO_INFO) == 0) { svn_ra_serf__xml_pop_state(parser); } return SVN_NO_ERROR; }
static svn_error_t * end_element(svn_ra_serf__xml_parser_t *parser, svn_ra_serf__dav_props_t name, apr_pool_t *scratch_pool) { iprops_context_t *iprops_ctx = parser->user_data; iprops_state_e state; state = parser->state->current_state; if (state == IPROPS_REPORT && strcmp(name.name, SVN_DAV__INHERITED_PROPS_REPORT) == 0) { svn_ra_serf__xml_pop_state(parser); } else if (state == IPROPS_PATH && strcmp(name.name, SVN_DAV__IPROP_PATH) == 0) { iprops_ctx->curr_iprop = apr_palloc( iprops_ctx->pool, sizeof(svn_prop_inherited_item_t)); iprops_ctx->curr_iprop->path_or_url = svn_path_url_add_component2(iprops_ctx->repos_root_url, iprops_ctx->curr_path->data, iprops_ctx->pool); iprops_ctx->curr_iprop->prop_hash = apr_hash_make(iprops_ctx->pool); svn_ra_serf__xml_pop_state(parser); } else if (state == IPROPS_PROPVAL && strcmp(name.name, SVN_DAV__IPROP_PROPVAL) == 0) { const svn_string_t *prop_val; if (iprops_ctx->curr_prop_val_encoding) { svn_string_t encoded_prop_val; if (strcmp(iprops_ctx->curr_prop_val_encoding, "base64") != 0) return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL); encoded_prop_val.data = iprops_ctx->curr_propval->data; encoded_prop_val.len = iprops_ctx->curr_propval->len; prop_val = svn_base64_decode_string(&encoded_prop_val, iprops_ctx->pool); } else { prop_val = svn_string_create_from_buf(iprops_ctx->curr_propval, iprops_ctx->pool); } svn_hash_sets(iprops_ctx->curr_iprop->prop_hash, apr_pstrdup(iprops_ctx->pool, iprops_ctx->curr_propname->data), prop_val); /* Clear current propname and propval in the event there are multiple properties on the current path. */ svn_stringbuf_setempty(iprops_ctx->curr_propname); svn_stringbuf_setempty(iprops_ctx->curr_propval); svn_ra_serf__xml_pop_state(parser); } else if (state == IPROPS_PROPNAME && strcmp(name.name, SVN_DAV__IPROP_PROPNAME) == 0) { svn_ra_serf__xml_pop_state(parser); } else if (state == IPROPS_ITEM && strcmp(name.name, SVN_DAV__IPROP_ITEM) == 0) { APR_ARRAY_PUSH(iprops_ctx->iprops, svn_prop_inherited_item_t *) = iprops_ctx->curr_iprop; svn_ra_serf__xml_pop_state(parser); }