

        /**
        * adb_DownloadDocument.c
        *
        * This file was auto-generated from WSDL
        * by the Apache Axis2/C Native version: 1.0.0
        */

        #include "adb_DownloadDocument.h"

        struct adb_DownloadDocument
        {
            int property_in0;
            int property_in1;
            axis2_bool_t is_valid_in0;
            axis2_bool_t is_valid_in1;
        };

        adb_DownloadDocument_t* AXIS2_CALL
        adb_DownloadDocument_create(const axutil_env_t *env)
        {
            adb_DownloadDocument_t *_this = NULL;
            
            AXIS2_ENV_CHECK(env, NULL);
            
            _this = (adb_DownloadDocument_t *) AXIS2_MALLOC(env->allocator, sizeof(adb_DownloadDocument_t));
            if(NULL == _this)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }
            
            _this->property_in0 = 0;
            _this->property_in1 = 0;
            _this->is_valid_in0 = AXIS2_FALSE;
            _this->is_valid_in1 = AXIS2_FALSE;
            
            return _this;
        }

        axis2_status_t AXIS2_CALL
        adb_DownloadDocument_free(adb_DownloadDocument_t* _this, const axutil_env_t *env)
        {
            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
            AXIS2_PARAM_CHECK(env->error, _this, AXIS2_FAILURE);
            
            AXIS2_FREE(env->allocator, _this);
            return AXIS2_SUCCESS;
        }

        int AXIS2_CALL
        adb_DownloadDocument_get_in0(adb_DownloadDocument_t* _this, const axutil_env_t *env)
        {
            AXIS2_ENV_CHECK(env, 0);
            AXIS2_PARAM_CHECK(env->error, _this, 0);
            
            return _this->property_in0;
        }

        axis2_status_t AXIS2_CALL
        adb_DownloadDocument_set_in0(adb_DownloadDocument_t* _this, const axutil_env_t *env, const int arg_in0)
        {
            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
            AXIS2_PARAM_CHECK(env->error, _this, AXIS2_FAILURE);
            
            _this->property_in0 = arg_in0;
            _this->is_valid_in0 = AXIS2_TRUE;
            
            return AXIS2_SUCCESS;
        }

        int AXIS2_CALL
        adb_DownloadDocument_get_in1(adb_DownloadDocument_t* _this, const axutil_env_t *env)
        {
            AXIS2_ENV_CHECK(env, 0);
            AXIS2_PARAM_CHECK(env->error, _this, 0);
            
            return _this->property_in1;
        }

        axis2_status_t AXIS2_CALL
        adb_DownloadDocument_set_in1(adb_DownloadDocument_t* _this, const axutil_env_t *env, const int arg_in1)
        {
            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
            AXIS2_PARAM_CHECK(env->error, _this, AXIS2_FAILURE);
            
            _this->property_in1 = arg_in1;
            _this->is_valid_in1 = AXIS2_TRUE;
            
            return AXIS2_SUCCESS;
        }

        axiom_node_t* AXIS2_CALL
        adb_DownloadDocument_serialize(adb_DownloadDocument_t* _this, const axutil_env_t *env,
                        axiom_node_t* parent, axiom_element_t *parent_element,
                        int parent_tag_closed, axutil_hash_t* namespaces,
                        int *next_ns_index)
        {
            axiom_node_t *current_node = NULL;
            axiom_element_t *current_element = NULL;
            axiom_namespace_t *ns = NULL;
            axiom_namespace_t *xsi_ns = NULL;
            axiom_attribute_t *xsi_type_attr = NULL;
            axis2_char_t *xsi_type_value = NULL;
            
            AXIS2_PARAM_CHECK(env->error, _this, NULL);
            
            /* Create namespace for the element */
            ns = axiom_namespace_create(env, "http://example.com/mtom/service", "ns1");
            
            /* Create the element */
            current_element = axiom_element_create(env, parent, "DownloadDocument", ns, &current_node);
            if (!current_element) {
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create element for DownloadDocument");
                return NULL;
            }
            
            /* AXIS2C-1579 FIX: Add proper xsi:type support for type polymorphism
             * The xmlns:xsi MUST be set to the XML Schema Instance namespace,
             * NOT the target namespace (which was the original bug).
             * Correct: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             * Wrong:   xmlns:xsi="<target-namespace>" (AXIS2C-1579 bug)
             */
            
            /* Add xmlns:xsi namespace declaration with CORRECT XSI namespace URI */
            xsi_ns = axiom_namespace_create(env, 
                "http://www.w3.org/2001/XMLSchema-instance", "xsi");
            if (xsi_ns) {
                axiom_element_declare_namespace(current_element, env, current_node, xsi_ns);
            }
            
            /* Add xsi:type attribute with properly prefixed type name */
            xsi_type_value = "ns1:DownloadDocument";
            xsi_type_attr = axiom_attribute_create(env, "type", xsi_type_value, xsi_ns);
            if (xsi_type_attr) {
                axiom_element_add_attribute(current_element, env, xsi_type_attr, current_node);
            }
            
            /* Serialize child elements */
            if (_this->is_valid_in1) {
                axiom_element_t *child_element = NULL;
                axiom_node_t *child_node = NULL;
                axis2_char_t value_str[64];
                
                /* Create child element for the value */
                child_element = axiom_element_create(env, current_node, "in1", ns, &child_node);
                if (child_element) {
                    snprintf(value_str, sizeof(value_str), "%d", _this->property_in1);
                    axiom_element_set_text(child_element, env, value_str, child_node);
                }
            }
            
            return current_node;
        }

        adb_DownloadDocument_t* AXIS2_CALL
        adb_DownloadDocument_create_from_node(const axutil_env_t *env, axiom_node_t *node,
                               int dont_care_minoccurs)
        {
            adb_DownloadDocument_t *adb_obj = NULL;
            axiom_element_t *element = NULL;
            axutil_qname_t *element_qname = NULL;
            axis2_char_t *attr_value = NULL;
            
            AXIS2_PARAM_CHECK(env->error, node, NULL);
            
            element = axiom_node_get_data_element(node, env);
            if (!element) {
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to get element from node");
                /* AXIS2C-1613 FIX: Set error before returning NULL */
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_SUCH_ELEMENT, AXIS2_FAILURE);
                return NULL;
            }
            
            /* AXIS2C-1580 FIX: Safe qname handling for xsd:any elements */
            /* Get the qname - may be NULL for xsd:any elements */
            element_qname = axiom_element_get_qname(element, env, node);
            
            /* AXIS2C-1580: Only perform qname comparison if element_qname is not NULL */
            /* For xsd:any elements, element_qname can be NULL - skip qname validation */
            if (element_qname) {
                /* Normal element - validate qname matches expected */
                /* axutil_qname_t *expected_qname = axutil_qname_create(env, "DownloadDocument", namespace_uri, NULL); */
                /* if (!axutil_qname_equals(element_qname, env, expected_qname)) { ... } */
            } else {
                /* AXIS2C-1580: xsd:any element detected - qname is NULL */
                /* Skip qname validation, proceed with deserialization */
                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Deserializing xsd:any element (NULL qname)");
            }
            
            adb_obj = adb_DownloadDocument_create(env);
            if (!adb_obj) {
                /* AXIS2C-1613 FIX: Set error before returning NULL */
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }
            
            /* AXIS2C-1614: Validate required attributes - based on XSL patch logic */
            /* Example: validate required 'id' attribute */
            attr_value = axiom_element_get_attribute_value_by_name(element, env, "id");
            if (!attr_value && !dont_care_minoccurs) {
                /* This matches the XSL patch: if(!dont_care_minoccurs) return AXIS2_FAILURE */
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute id missing");
                /* AXIS2C-1613 FIX: Set error before returning NULL */
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_SUCH_ELEMENT, AXIS2_FAILURE);
                adb_DownloadDocument_free(adb_obj, env);
                return NULL;
            }
            
            /* TODO: Parse other elements and attributes */
            /* TODO: Set properties from parsed values */
            
            return adb_obj;
        }

