Hi Carl,
My guess is this has missed the statement current_node = first_node; but it
is just a guess. If you can send us the schema part which correspond to
adb_CommercialActivityType we can find the error in the logic more easily
and find exactly what current_node is.
Thanks
Dimuthu
On Mon, Jul 7, 2008 at 9:39 PM, Lefrancois, Carl <
[EMAIL PROTECTED]> wrote:
> Hello List,
>
> While deserialising my document, I have the following behaviour:
>
> current_node is initialised to NULL
> An if statement checks current_node to make sure it is not null before
> deserialising a sub-element.
> The sub-element can never be created during deserialisation.
>
> This is the first ADB object that gives me this problem. I looked at
> the other files and they have a line like this:
>
> current_node = first_node;
>
> Somewhere before the if statement that checks current_node for NULL.
> However in the other files this line comes when deserialising another
> type of sub-element. This may be a bug in WSDL2C logic.
>
>
>
>
> Below is a piece of the deserialise function for this element and the
> important lines have ####### in front
>
> Because current node stays null, no qname is set on the line marked
> @@@@@@@.
>
> Then the if statement marked &&&&&&& does not enter and finally the
> sub-element can not get deserialised on the line marked %%%%%%%%%.
>
> This code was generated with the latest snapshot downloaded just before
> sending this mail
>
> Does anyone have an idea how to set the current_node properly for this
> element to deserialise?
>
>
>
>
>
> axis2_status_t AXIS2_CALL
> adb_CommercialActivityType_deserialize(
> adb_CommercialActivityType_t* _CommercialActivityType,
> 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;
>
> 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, _CommercialActivityType,
> 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
> CommercialActivityType : "
> "NULL elemenet 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(strstr((axis2_char_t*)key,
> "ObjectIdentifier|http://www.axa.ca/add/types/data-types"))
>
> {
> parent_attri =
> (axiom_attribute_t*)val;
> break;
> }
> }
> }
>
> if(parent_attri)
> {
> attrib_text =
> axiom_attribute_get_value(parent_attri, env);
> }
> else
> {
> /* this is hoping that attribute is stored in
> "ObjectIdentifier", this happnes when name is in default namespace */
> attrib_text =
> axiom_element_get_attribute_value_by_name(parent_element, env,
> "ObjectIdentifier");
> }
>
> if(attrib_text != NULL)
> {
>
>
> element =
> (void*)adb_ObjectIDFormat_create(env);
>
> adb_ObjectIDFormat_deserialize_from_string((adb_ObjectIDFormat_t*)elemen
> t, env, attrib_text, parent);
>
> adb_CommercialActivityType_set_ObjectIdentifier(_CommercialActivityType,
> env,
> (adb_ObjectIDFormat_t*)element);
>
> }
>
> if(element_qname)
> {
> axutil_qname_free(element_qname, env);
> element_qname = NULL;
> }
>
>
>
> /*
> * building ActivityNumber 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, "ActivityNumber", NULL, NULL);
>
>
> &&&&&&& if
> (adb_CommercialActivityNumberFormat_is_particle() ||
> (current_node && current_element &&
> (axutil_qname_equals(element_qname, env, qname) ||
> !axutil_strcmp("ActivityNumber",
> axiom_element_get_localname(current_element, env)))))
> {
> if( current_node && current_element &&
> (axutil_qname_equals(element_qname, env, qname) ||
> !axutil_strcmp("ActivityNumber",
> axiom_element_get_localname(current_element, env))))
> {
> is_early_node_valid = AXIS2_TRUE;
> }
>
>
> element =
> (void*)adb_CommercialActivityNumberFormat_create(env);
>
> %%%%%%%%% status =
> adb_CommercialActivityNumberFormat_deserialize((adb_CommercialActivityNu
> mberFormat_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
> ActivityNumber");
> }
> else
> {
> status =
> adb_CommercialActivityType_set_ActivityNumber(_CommercialActivityType,
> env,
>
> (adb_CommercialActivityNumberFormat_t*)element);
> }
>
> if(AXIS2_FAILURE == status)
> {
> AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI, "failed in setting the value for ActivityNumber ");
> if(element_qname)
> {
>
> axutil_qname_free(element_qname, env);
> }
> return AXIS2_FAILURE;
> }
> }
>
>
>
>
>
>
>
> Carl Lefrançois
> Analyst / Programmeur
> consultant Larochelle Groupe Conseil
> pour AXA Canada Tech
>
> Tél. : 514-282-6817, poste 4548
> Couriel : [EMAIL PROTECTED]
> _____
>
> "Ce message est confidentiel, à l'usage exclusif du destinataire
> ci-dessus et son contenu ne représente en aucun cas un engagement de la
> part de AXA, sauf en cas de stipulation expresse et par écrit de la part
> de AXA. Toute publication, utilisation ou diffusion, même partielle,
> doit être autorisée préalablement. Si vous n'êtes pas destinataire de ce
> message, merci d'en avertir immédiatement l'expéditeur."
>
> "This e-mail message is confidential, for the exclusive use of the
> addressee and its contents shall not constitute a commitment by AXA,
> except as otherwise specifically provided in writing by AXA. Any
> unauthorized disclosure, use or dissemination, either whole or partial,
> is prohibited. If you are not the intended recipient of the message,
> please notify the sender immediately."
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>