axis2_bool_t axis2_json_element_is_nil(axiom_element_t* om_element, const axutil_env_t* env) { axiom_attribute_t* attr = NULL; axutil_hash_index_t* index; axutil_hash_t* attr_hash = axiom_element_get_all_attributes(om_element, env); if (!attr_hash) return AXIS2_FALSE; for (index = axutil_hash_first(attr_hash, env); index; index = axutil_hash_next(env, index)) { axutil_hash_this(index, NULL, NULL, (void**)&attr); if (attr && !strcmp(axiom_attribute_get_localname(attr, env), "nil")) { /* found some "nil" attribute, check it namespace */ axutil_qname_t* qname = axiom_attribute_get_qname(attr, env); if (qname && !strcmp(axutil_qname_get_uri(qname, env), AXIS2_JSON_XSI_URI)) { axis2_char_t* attr_value = axiom_attribute_get_value(attr, env); return (!strcmp(attr_value, "true") || !strcmp(attr_value, "1")) ? AXIS2_TRUE : AXIS2_FALSE; } } } return AXIS2_FALSE; }
/** * Auxiliary function to determine an ADB object type from its Axiom node. * @param env pointer to environment struct * @param node double pointer to the parent node to deserialize * @return type name on success, else NULL */ axis2_char_t *AXIS2_CALL axis2_extension_mapper_type_from_node( const axutil_env_t *env, axiom_node_t** node) { axiom_node_t *parent = *node; axutil_qname_t *element_qname = NULL; axiom_element_t *element = NULL; axutil_hash_index_t *hi; void *val; axiom_attribute_t *type_attr; axutil_hash_t *ht; axis2_char_t *temp; axis2_char_t *type; while(parent && axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, env); } if (NULL == parent) { /* This should be checked before everything */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } element = (axiom_element_t *)axiom_node_get_data_element(parent, env); ht = axiom_element_get_all_attributes(element, env); if (ht == NULL) return NULL; for (hi = axutil_hash_first(ht, env); hi; hi = axutil_hash_next(env, hi)) { axis2_char_t *localpart; axutil_hash_this(hi, NULL, NULL, &val); type_attr = (axiom_attribute_t *)val; localpart = axutil_qname_get_localpart(axiom_attribute_get_qname(type_attr, env), env); if (axutil_strcmp(localpart, "type") == 0) break; } type = axiom_attribute_get_value(type_attr, env); if (type != NULL && (temp = axutil_strchr(type, ':')) != NULL) { if (axutil_strchr(temp, ':') != NULL) type = temp + 1; /* Pointer arithmetic */ } return type; }
void get_all_policy( axis2_char_t * element_name, const axutil_env_t * env, axutil_array_list_t * policy_node_list, axis2_char_t * wsdl_name) { axutil_hash_t *attr_hash = NULL; axutil_hash_index_t *hi = NULL; axiom_element_t *element = NULL; axiom_attribute_t *attribute = NULL; axis2_char_t *attribute_val = NULL; axiom_node_t *parent_policy_node = NULL, *parent_node = NULL; parent_node = return_policy_element(element_name, env, wsdl_name); if (!parent_node) return; parent_policy_node = return_policy_element(get_policy_ref(parent_node, env), env, wsdl_name); axutil_array_list_add(policy_node_list, env, parent_policy_node); if (axiom_node_get_node_type(parent_node, env) == AXIOM_ELEMENT) { element = (axiom_element_t *) axiom_node_get_data_element(parent_node, env); attr_hash = axiom_element_get_all_attributes(element, env); if (attr_hash) { hi = axutil_hash_next(env, axutil_hash_first(attr_hash, env)); do { if (hi) { axutil_hash_this(hi, NULL, NULL, &attribute); attribute_val = axiom_attribute_get_value(attribute, env); attribute_val = axutil_rindex(attribute_val, ':'); attribute_val = axutil_string_substring_starting_at(attribute_val, 1); get_all_policy(attribute_val, env, policy_node_list, wsdl_name); hi = axutil_hash_next(env, hi); } } while (hi); } } return; }
axis2_status_t AXIS2_CALL adb_UAKType_deserialize_obj( adb_UAKType_t* _UAKType, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; axiom_attribute_t *parent_attri = NULL; axiom_element_t *parent_element = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; void *element = NULL; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; status = AXIS2_FAILURE; if(parent) { axis2_char_t *attrib_text = NULL; attrib_text = axiom_element_get_attribute_value_by_name(axiom_node_get_data_element(parent, env), env, "nil"); if (attrib_text != NULL && !axutil_strcasecmp(attrib_text, "true")) { /* but the wsdl says that, this is non nillable */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element UAKType"); status = AXIS2_FAILURE; } else { axiom_node_t *text_node = NULL; axiom_text_t *text_element = NULL; text_node = axiom_node_get_first_child(parent, env); if (text_node && axiom_node_get_node_type(text_node, env) == AXIOM_TEXT) text_element = (axiom_text_t*)axiom_node_get_data_element(text_node, env); text_value = ""; if(text_element && axiom_text_get_value(text_element, env)) { text_value = (axis2_char_t*)axiom_text_get_value(text_element, env); } status = adb_UAKType_deserialize_from_string(_UAKType, env, text_value, parent); } } parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(parent_element, env); parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "issuerID")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "issuerID", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "issuerID"); } if(attrib_text != NULL) { adb_UAKType_set_issuerID(_UAKType, env, attrib_text); } else if(!dont_care_minoccurs) { /* if(element_qname) { axutil_qname_free(element_qname, env); } */ /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute issuerID missing"); return AXIS2_FAILURE; } parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "collectionID")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "collectionID", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "collectionID"); } if(attrib_text != NULL) { adb_UAKType_set_collectionID(_UAKType, env, attrib_text); } else if(!dont_care_minoccurs) { /* if(element_qname) { axutil_qname_free(element_qname, env); } */ /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute collectionID missing"); return AXIS2_FAILURE; } return status; }
axis2_status_t AXIS2_CALL adb_TransformTypeChoice_deserialize_obj( adb_TransformTypeChoice_t* _TransformTypeChoice, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, _TransformTypeChoice, AXIS2_FAILURE); first_node = parent; /* * building extraElement element */ current_node = first_node; is_early_node_valid = AXIS2_FALSE; if ( (current_node )) { if( current_node ) { is_early_node_valid = AXIS2_TRUE; } text_value = NULL; /* just to avoid warning */ { axiom_node_t *current_property_node = current_node; current_node = axiom_node_get_next_sibling(current_node, env); axiom_node_detach(current_property_node, env); status = adb_TransformTypeChoice_set_extraElement(_TransformTypeChoice, env, current_property_node); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for extraElement "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } /* * building XPath element */ /* * because elements are ordered this works fine */ if(current_node != NULL && is_early_node_valid) { current_node = axiom_node_get_next_sibling(current_node, env); while(current_node && axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, env); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); } } is_early_node_valid = AXIS2_FALSE; element_qname = axutil_qname_create(env, "XPath", "http://www.w3.org/2000/09/xmldsig#", NULL); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname)))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname))) { is_early_node_valid = AXIS2_TRUE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = adb_TransformTypeChoice_set_XPath(_TransformTypeChoice, env, text_value); } else { /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "nil|http://www.w3.org/2001/XMLSchema-instance")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "nil"); } if(attrib_text && 0 == axutil_strcmp(attrib_text, "1")) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element XPath"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = adb_TransformTypeChoice_set_XPath(_TransformTypeChoice, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for XPath "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } *dp_parent = current_node; *dp_is_early_node_valid = is_early_node_valid; return status; }
axis2_status_t AXIS2_CALL adb_CanonicalizationMethodType_deserialize_obj( adb_CanonicalizationMethodType_t* _CanonicalizationMethodType, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; axiom_attribute_t *parent_attri = NULL; axiom_element_t *parent_element = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, _CanonicalizationMethodType, AXIS2_FAILURE); while(parent && axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, env); } if (NULL == parent) { /* This should be checked before everything */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for CanonicalizationMethodType : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(parent_element, env); /* * building extraElement array */ arr_list = axutil_array_list_create(env, 10); /* * building extraElement element */ /* 'any' arrays are not handling correctly when there are other elements mixed with the 'any' element. */ for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("extraElement", axiom_element_get_localname(current_element, env)))) { is_early_node_valid = AXIS2_TRUE; } text_value = NULL; /* just to avoid warning */ { axiom_node_t *current_property_node = current_node; current_node = axiom_node_get_next_sibling(current_node, env); axiom_node_detach(current_property_node, env); axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for extraElement "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = adb_CanonicalizationMethodType_set_extraElement(_CanonicalizationMethodType, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "Algorithm")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "Algorithm", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "Algorithm"); } if(attrib_text != NULL) { adb_CanonicalizationMethodType_set_Algorithm(_CanonicalizationMethodType, env, axutil_uri_parse_string(env, attrib_text)); } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute Algorithm missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
AXIS2_EXTERN int AXIS2_CALL saml_attr_query_build(saml_attr_query_t* attribute_query, axiom_node_t *node, const axutil_env_t *env) { axutil_hash_t *attr_hash = NULL; axiom_element_t *element = NULL; axutil_hash_index_t *hi = NULL; axiom_child_element_iterator_t *iterator = NULL; axiom_node_t *child_node; saml_attr_desig_t *attr_desig = NULL; if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT) { return AXIS2_FAILURE; } if ((element = axiom_node_get_data_element(node, env)) == NULL) { return AXIS2_FAILURE; } /* initialize the attributes */ attr_hash = axiom_element_get_all_attributes(element, env); /*One resource attribute relate to the attibute query*/ for (hi = axutil_hash_first(attr_hash, env); hi; hi = axutil_hash_next(env, hi)) { void *v = NULL; axutil_hash_this(hi, NULL, NULL, &v); if (v) { axis2_char_t *attr_val = NULL; axiom_attribute_t *attr = (axiom_attribute_t*)v; attr_val = axiom_attribute_get_value(attr, env); if(!axutil_strcmp(axiom_attribute_get_localname(attr, env),SAML_RESOURCE)) { attribute_query->resource = attr_val; break; } } } iterator = axiom_element_get_child_elements(element, env, node); if(iterator) { while(axiom_child_element_iterator_has_next(iterator, env)) { child_node = axiom_child_element_iterator_next(iterator, env); element = (axiom_element_t *)axiom_node_get_data_element(child_node, env); if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), SAML_SUBJECT))) { if(attribute_query->subject) saml_subject_build(attribute_query->subject, child_node, env); } else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), SAML_ATTRIBUTE_DESIGNATOR))) { /*attr_desig = saml_attr_desig_create(env); */ attr_desig = (saml_attr_desig_t*)AXIS2_MALLOC(env->allocator, sizeof(saml_attr_desig_t)); if( AXIS2_SUCCESS == saml_attr_desig_build(attr_desig, child_node, env)) { axutil_array_list_add(attribute_query->attr_desigs,env, attr_desig); } } } return AXIS2_SUCCESS; } else return AXIS2_FAILURE; }
AXIS2_EXTERN int AXIS2_CALL saml_autho_decision_query_build(saml_autho_decision_query_t* autho_decision_query, axiom_node_t *node, const axutil_env_t *env) { axutil_hash_t *attr_hash = NULL; axiom_element_t *element = NULL; axutil_hash_index_t *hi = NULL; axiom_child_element_iterator_t *iterator = NULL; axiom_node_t *child_node; saml_action_t *action; if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT) { return AXIS2_FAILURE; } if ((element = axiom_node_get_data_element(node, env)) == NULL) { return AXIS2_FAILURE; } /* initialize the attributes */ attr_hash = axiom_element_get_all_attributes(element, env); for (hi = axutil_hash_first(attr_hash, env); hi; hi = axutil_hash_next(env, hi)) { void *v = NULL; axutil_hash_this(hi, NULL, NULL, &v); if (v) { axis2_char_t *attr_val = NULL; axiom_attribute_t *attr = (axiom_attribute_t*)v; attr_val = axiom_attribute_get_value(attr, env); if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_RESOURCE)) { if(autho_decision_query->resource) { autho_decision_query->resource = attr_val; break; } else return AXIS2_FAILURE; } } } iterator = axiom_element_get_child_elements(element, env, node); if(iterator) { while(axiom_child_element_iterator_has_next(iterator, env)) { child_node = axiom_child_element_iterator_next(iterator, env); element = (axiom_element_t *)axiom_node_get_data_element(child_node, env); if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), SAML_SUBJECT))) { if(autho_decision_query->subject) saml_subject_build(autho_decision_query->subject, child_node, env); } else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), SAML_ACTION))) { if(autho_decision_query->saml_actions) { action = saml_action_create(env); saml_action_build(action, child_node, env); axutil_array_list_add(autho_decision_query->saml_actions, env, action); } } else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), SAML_EVIDENCE))) { if(autho_decision_query->evidence) saml_evidence_build(autho_decision_query->evidence, child_node, env); } } return AXIS2_SUCCESS; } else return AXIS2_FAILURE; }
AXIS2_EXTERN int AXIS2_CALL saml_authentication_query_build(saml_authentication_query_t* authentication_query, axiom_node_t *node, const axutil_env_t *env) { axutil_hash_t *attr_hash = NULL; axiom_element_t *element = NULL; axutil_hash_index_t *hi = NULL; axiom_child_element_iterator_t *iterator = NULL; axiom_node_t *child_node; if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT) { return AXIS2_FAILURE; } if ((element = axiom_node_get_data_element(node, env)) == NULL) { return AXIS2_FAILURE; } /* initialize the attributes */ attr_hash = axiom_element_get_all_attributes(element, env); if(attr_hash) { for (hi = axutil_hash_first(attr_hash, env); hi; hi = axutil_hash_next(env, hi)) { void *v = NULL; axutil_hash_this(hi, NULL, NULL, &v); if (v) { axis2_char_t *attr_val = NULL; axiom_attribute_t *attr = (axiom_attribute_t*)v; attr_val = axiom_attribute_get_value(attr, env); if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_AUTHENTICATION_METHOD)) { authentication_query->auth_method = attr_val; break; } } } } iterator = axiom_element_get_child_elements(element, env, node); if(iterator) { while(axiom_child_element_iterator_has_next(iterator, env)) { child_node = axiom_child_element_iterator_next(iterator, env); element = (axiom_element_t *)axiom_node_get_data_element(child_node, env); if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), SAML_SUBJECT))) { if(authentication_query->subject) return saml_subject_build(authentication_query->subject, child_node, env); else return AXIS2_FAILURE; } } return AXIS2_SUCCESS; } else return AXIS2_FAILURE; }
axis2_status_t AXIS2_CALL adb_SnakeException_deserialize( adb_SnakeException_t* _SnakeException, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, _SnakeException, AXIS2_FAILURE); while(parent && axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, env); } if (NULL == parent) { /* This should be checked before everything */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for SnakeException : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building message element */ current_node = first_node; is_early_node_valid = AXIS2_FALSE; while(current_node && axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, env); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); } element_qname = axutil_qname_create(env, "message", NULL, NULL); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("message", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("message", axiom_element_get_localname(current_element, env)))) { is_early_node_valid = AXIS2_TRUE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = adb_SnakeException_set_message(_SnakeException, env, text_value); } else { /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "nil|http://www.w3.org/2001/XMLSchema-instance")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "nil"); } if(attrib_text && 0 == axutil_strcmp(attrib_text, "1")) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element message"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = adb_SnakeException_set_message(_SnakeException, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for message "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_service_type0_deserialize_obj( adb_service_type0_t* _service_type0, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; axiom_attribute_t *parent_attri = NULL; axiom_element_t *parent_element = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; void *element = NULL; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, _service_type0, AXIS2_FAILURE); while(parent && axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, env); } if (NULL == parent) { /* This should be checked before everything */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for service_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(parent_element, env); /* * building label element */ current_node = first_node; is_early_node_valid = AXIS2_FALSE; while(current_node && axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, env); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); } element_qname = axutil_qname_create(env, "label", "http://www.daisy.org/ns/daisy-online/", NULL); if (adb_label_type0_is_particle() || (current_node && current_element && (axutil_qname_equals(element_qname, env, qname)))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname))) { is_early_node_valid = AXIS2_TRUE; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_label_type0"); status = adb_label_type0_deserialize((adb_label_type0_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element label"); } else { status = adb_service_type0_set_label(_service_type0, env, (adb_label_type0_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for label "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "id")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "id", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "id"); } if(attrib_text != NULL) { adb_service_type0_set_id(_service_type0, env, attrib_text); } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute id missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_audio_type0_deserialize_obj( adb_audio_type0_t* _audio_type0, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; axiom_attribute_t *parent_attri = NULL; axiom_element_t *parent_element = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, _audio_type0, AXIS2_FAILURE); while(parent && axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, env); } if (NULL == parent) { /* This should be checked before everything */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for audio_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(parent_element, env); parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "uri")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "uri", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "uri"); } if(attrib_text != NULL) { adb_audio_type0_set_uri(_audio_type0, env, axutil_uri_parse_string(env, attrib_text)); } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute uri missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "rangeBegin")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "rangeBegin", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "rangeBegin"); } if(attrib_text != NULL) { adb_audio_type0_set_rangeBegin(_audio_type0, env, axutil_strtol(attrib_text, (char**)NULL, 0)); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "rangeEnd")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "rangeEnd", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "rangeEnd"); } if(attrib_text != NULL) { adb_audio_type0_set_rangeEnd(_audio_type0, env, axutil_strtol(attrib_text, (char**)NULL, 0)); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } parent_attri = NULL; attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(!strcmp((axis2_char_t*)key, "size")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "size", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "size"); } if(attrib_text != NULL) { adb_audio_type0_set_size(_audio_type0, env, axutil_strtol(attrib_text, (char**)NULL, 0)); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_supportedContentFormats_type0_deserialize_obj( adb_supportedContentFormats_type0_t* _supportedContentFormats_type0, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, _supportedContentFormats_type0, AXIS2_FAILURE); while(parent && axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, env); } if (NULL == parent) { /* This should be checked before everything */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for supportedContentFormats_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building contentFormat array */ arr_list = axutil_array_list_create(env, 10); /* * building contentFormat element */ element_qname = axutil_qname_create(env, "contentFormat", "http://www.daisy.org/ns/daisy-online/", NULL); for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname)))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname))) { is_early_node_valid = AXIS2_TRUE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, text_value)); } else { /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "nil|http://www.w3.org/2001/XMLSchema-instance")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "nil"); } if(attrib_text && 0 == axutil_strcmp(attrib_text, "1")) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element contentFormat"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, "")); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for contentFormat "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; current_node = axiom_node_get_next_sibling(current_node, env); } else { is_early_node_valid = AXIS2_FALSE; sequence_broken = 1; } } if (i < 0) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "contentFormat (@minOccurs = '0') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = adb_supportedContentFormats_type0_set_contentFormat(_supportedContentFormats_type0, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
static void ngx_squ_xml_parse_children(squ_State *l, axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_elem) { int n; char *uri, *prefix, *name, *text, *value; axiom_node_t *node; axutil_hash_t *attrs; axiom_element_t *elem; ngx_squ_thread_t *thr; axiom_attribute_t *attr; axiom_namespace_t *ns; axutil_hash_index_t *hi; axiom_child_element_iterator_t *it; thr = ngx_squ_thread(l); ngx_log_debug0(NGX_LOG_DEBUG_CORE, thr->log, 0, "squ xml parse children"); it = axiom_element_get_child_elements(parent_elem, env, parent); if (it == NULL) { return; } n = 1; do { node = axiom_child_element_iterator_next(it, env); elem = axiom_node_get_data_element(node, env); name = axiom_element_get_localname(elem, env); squ_createtable(l, 2, 4); squ_pushstring(l, name); squ_setfield(l, -2, "name"); ns = axiom_element_get_namespace(elem, env, node); if (ns != NULL) { uri = axiom_namespace_get_uri(ns, env); if (uri != NULL) { squ_pushstring(l, uri); squ_setfield(l, -2, "uri"); } prefix = axiom_namespace_get_prefix(ns, env); if (prefix != NULL) { squ_pushstring(l, prefix); squ_setfield(l, -2, "prefix"); } } attrs = axiom_element_get_all_attributes(elem, env); if (attrs != NULL) { squ_newtable(l); hi = axutil_hash_first(attrs, env); do { if (hi == NULL) { break; } axutil_hash_this(hi, NULL, NULL, (void **) &attr); name = axiom_attribute_get_localname(attr, env); value = axiom_attribute_get_value(attr, env); squ_pushstring(l, value); squ_setfield(l, -2, name); hi = axutil_hash_next(env, hi); } while (1); squ_setfield(l, -2, "attributes"); } text = axiom_element_get_text(elem, env, node); if (text != NULL) { squ_pushstring(l, text); squ_setfield(l, -2, "text"); } else { squ_newtable(l); ngx_squ_xml_parse_children(l, env, node, elem); squ_setfield(l, -2, "children"); } squ_setfield(l, -2, name); squ_getfield(l, -1, name); squ_rawseti(l, -2, n++); } while (axiom_child_element_iterator_has_next(it, env) == AXIS2_TRUE); }
axis2_status_t AXIS2_CALL adb_lang_type0_deserialize_from_string( adb_lang_type0_t* _lang_type0, const axutil_env_t *env, const axis2_char_t *node_value, axiom_node_t *parent) { axis2_status_t status = AXIS2_SUCCESS; /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "type", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; void *element = NULL; axiom_element_t *current_element = NULL; current_element = (axiom_element_t*)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "lang|http://www.w3.org/XML/1998/namespace")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "type"); } if(attrib_text) { /* skipping the namespace prefix */ axis2_char_t *temp_attrib = NULL; temp_attrib = strchr(attrib_text, ':'); if(temp_attrib) { /* take the string after the ':' character */ attrib_text = temp_attrib + 1; } } if(!attrib_text) { /* nothing is here, reset things */ status = adb_lang_type0_reset_members(_lang_type0, env); } else { status = adb_lang_type0_set_language(_lang_type0, env, attrib_text); } return status; }
axiom_node_t * return_policy_element( axis2_char_t * name, const axutil_env_t * env, axis2_char_t * wsdl_name) { axiom_element_t *ele1 = NULL, *ele2 = NULL; axiom_document_t *document = NULL; axiom_node_t *node1 = NULL, *node2 = NULL, *policy_node = NULL; axiom_namespace_t *ns = NULL; axiom_xml_reader_t *reader = NULL; axiom_stax_builder_t *builder = NULL; char *buffer = NULL; axiom_attribute_t *attr = NULL; axis2_char_t *value = NULL; axis2_char_t *val = NULL; axutil_hash_t *attr_hash = NULL; axis2_char_t *xml_output = NULL; axutil_hash_index_t *hi; /* f = fopen(wsdl_name, "r"); if (!f) return NULL; reader = axiom_xml_reader_create_for_io(env, read_input, NULL , NULL, NULL); */ reader = axiom_xml_reader_create_for_file(env, wsdl_name, NULL); if (!reader) { printf("ERROR CREATING PULLPARSER"); return NULL; } builder = axiom_stax_builder_create(env, reader); if (!builder) { printf("ERROR CREATING PULL PARSER"); return NULL; } document = axiom_stax_builder_get_document(builder, env); if (!document) return NULL; node1 = axiom_document_get_root_element(document, env); if (!node1) { printf(" root element null "); axiom_stax_builder_free(builder, env); return NULL; } do { node2 = axiom_document_build_next(document, env); if (!node2) break; if (axiom_node_get_node_type(node2, env) == AXIOM_ELEMENT) { ele2 = (axiom_element_t *) axiom_node_get_data_element(node2, env); attr_hash = axiom_element_get_all_attributes(ele2, env); if (attr_hash) { hi = axutil_hash_first(attr_hash, env); axutil_hash_this(hi, NULL, NULL, &attr); if (axutil_strcmp(axiom_attribute_get_value(attr, env), name) == 0) { policy_node = node2; } } } } while (node2); return policy_node; }