Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 68469 invoked from network); 10 Nov 2005 02:48:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Nov 2005 02:48:23 -0000 Received: (qmail 73855 invoked by uid 500); 10 Nov 2005 02:48:23 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 73740 invoked by uid 500); 10 Nov 2005 02:48:22 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 73729 invoked by uid 99); 10 Nov 2005 02:48:22 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2005 18:48:22 -0800 X-ASF-Spam-Status: No, hits=0.9 required=10.0 tests=HTML_10_20,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jayawark@gmail.com designates 64.233.184.192 as permitted sender) Received: from [64.233.184.192] (HELO wproxy.gmail.com) (64.233.184.192) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2005 18:48:14 -0800 Received: by wproxy.gmail.com with SMTP id 67so801400wri for ; Wed, 09 Nov 2005 18:48:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=ar+LPYiIYBDMfFHfOg3BovdM+t2Q4fhK7JVWcoGQ4S4nxYGFsQWMWmfIJTWfRw+8aJbNDA2u5Q1lRYSuwfwLEh3xkQu9r1+YjQpM693/Q0EpeleDgEy+h7FArXwzz1I2cwTVdUxcyjGxZET5Yyrxrmc5kQ8AQG4QvQFld5DOuVQ= Received: by 10.54.104.7 with SMTP id b7mr189539wrc; Wed, 09 Nov 2005 18:48:00 -0800 (PST) Received: by 10.54.63.12 with HTTP; Wed, 9 Nov 2005 18:48:00 -0800 (PST) Message-ID: <5e8118f30511091847w23c16cdeo3a9f42e1893b841a@mail.gmail.com> Date: Thu, 10 Nov 2005 02:48:00 +0000 From: nandika jayawardana To: Apache AXIS C Developers List Subject: [Axis2] patch changes to om MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_11481_27088583.1131590880027" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_11481_27088583.1131590880027 Content-Type: multipart/alternative; boundary="----=_Part_11482_11283943.1131590880027" ------=_Part_11482_11283943.1131590880027 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all, I have made some changes to om code and corrected the test_om.c file to wor= k with new changes. pls apply this patch Thanks . nandika ------=_Part_11482_11283943.1131590880027 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all,
I have made some changes to om code and corrected the test_om.c file to wor= k with new changes.

pls apply this patch

Thanks .

nandika
------=_Part_11482_11283943.1131590880027-- ------=_Part_11481_27088583.1131590880027 Content-Type: application/octet-stream; name=omdiff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="omdiff" Index: test/om/src/test_om.c =================================================================== --- test/om/src/test_om.c (revision 332022) +++ test/om/src/test_om.c (working copy) @@ -1,4 +1,4 @@ -#include + #include #include #include #include @@ -8,7 +8,6 @@ #include axis2_allocator_t *allocator = NULL; -axis2_string_t *string = NULL; axis2_env_t *environment = NULL; guththila_environment_t *my_guththila_environment = NULL; @@ -22,88 +21,95 @@ guththila_xml_pull_parser_t *parser = NULL; axis2_om_element_t *ele1 = NULL, *ele2 = NULL, *ele3 = NULL, *ele4 = NULL; axis2_om_stax_builder_t *builder = NULL; + axis2_om_text_t *text = NULL; axis2_om_document_t *document = NULL; axis2_om_node_t *node1 = NULL, *node2 = NULL, *node3 = NULL; FILE *fp = NULL; axis2_om_output_t *om_output = NULL; + axis2_om_namespace_t* ns = NULL; fp = fopen (file_name, "r"); - + + reader = guththila_reader_create (my_guththila_environment, fp); parser = guththila_xml_pull_parser_create (my_guththila_environment, reader); guththila_xml_pull_parser_read (my_guththila_environment, parser); - - if (!fp) + + + builder = axis2_om_stax_builder_create (&environment, parser, + my_guththila_environment); + + document = axis2_om_document_create (&environment, NULL, builder); + node1 = AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT (document,&environment); + if(node1) { - printf ("Read Failed"); - } + printf ("NODE TYPE %d\n",AXIS2_OM_NODE_GET_NODE_TYPE(node1,&environment)); + + ele1 =AXIS2_OM_NODE_GET_DATA_ELEMENT(node1,&environment); + if(ele1) + + printf ("root localname %s\n",AXIS2_OM_ELEMENT_GET_LOCALNAME(ele1,&environment)); + + ns = AXIS2_OM_ELEMENT_GET_NAMESPACE(ele1,&environment); + + if (ns) + { + printf ("root ns prefix %s\n", AXIS2_OM_NAMESPACE_GET_PREFIX(ns,&environment)); + printf ("root ns uri %s\n", AXIS2_OM_NAMESPACE_GET_PREFIX(ns,&environment)); - builder = - axis2_om_stax_builder_create (environment, parser, - my_guththila_environment); - document = axis2_om_document_create (environment, NULL, builder); - printf ("START: pull document\n"); - node1 = axis2_om_document_get_root_element (environment, document); - printf ("root localname %s\n", - ((axis2_om_element_t *) (node1->data_element))->localname); - if (((axis2_om_element_t *) (node1->data_element))->ns) - printf ("root ns prefix %s\n", - ((axis2_om_element_t *) (node1->data_element))->ns->prefix); - if (((axis2_om_element_t *) (node1->data_element))->ns) - printf ("root ns uri %s\n", - ((axis2_om_element_t *) (node1->data_element))->ns->uri); - - - node2 = axis2_om_document_build_next (environment, document); + } + } + + node2 = AXIS2_OM_DOCUMENT_BUILD_NEXT( document , &environment); do { if (!node2) break; - switch (node2->node_type) + switch (AXIS2_OM_NODE_GET_NODE_TYPE(node2,&environment)) { case AXIS2_OM_ELEMENT: - if (((axis2_om_element_t *) (node2->data_element))->localname) - printf ("Element localname %s\n", - ((axis2_om_element_t *) (node2->data_element))-> - localname); + ele2 =(axis2_om_element_t*) AXIS2_OM_NODE_GET_DATA_ELEMENT(node2, &environment); + if(ele2 && AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment)) + printf("Element localname %s\n" , AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment)); + break; case AXIS2_OM_TEXT: - if (((axis2_om_text_t *) (node2->data_element)) - && ((axis2_om_text_t *) (node2->data_element))->value) - printf ("Element Text value %s\n", - ((axis2_om_text_t *) (node2->data_element))->value); + + text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node2,&environment); + if( text && AXIS2_OM_TEXT_GET_VALUE(text ,&environment)) + printf("Text value %s \n", AXIS2_OM_TEXT_GET_VALUE(text,&environment)); break; default: break; } - node2 = axis2_om_document_build_next (environment, document); + node2 = AXIS2_OM_DOCUMENT_BUILD_NEXT (document , &environment); } while (node2); printf ("END: pull document\n"); printf ("Serialize pulled document\n"); - om_output = axis2_om_output_create (environment, NULL, NULL); - axis2_om_node_serialize (environment, node1, om_output); - axis2_free (environment->allocator, om_output); - axis2_om_document_free (environment, document); - axis2_om_stax_builder_free (environment, builder); + + om_output = axis2_om_output_create (&environment, NULL, NULL); + AXIS2_OM_NODE_SERIALIZE (node1, &environment , om_output); + + AXIS2_FREE (environment->allocator, om_output); + + AXIS2_OM_DOCUMENT_FREE (document, &environment); + + AXIS2_OM_STAX_BUILDER_FREE ( builder, &environment); guththila_xml_pull_parser_free (my_guththila_environment, parser); - + printf ("\n\n"); } -/* - -TEST -*/ int test_om_serialize () @@ -120,7 +126,7 @@

- */ + */ axis2_om_element_t *ele1 = NULL, *ele2 = NULL, *ele3 = NULL, *ele4 = NULL, *ele5 = NULL; axis2_om_node_t *node1 = NULL, *node2 = NULL, *node3 = NULL, *node4 = @@ -131,49 +137,42 @@ axis2_om_output_t *om_output = NULL; ns1 = - axis2_om_namespace_create (environment, + axis2_om_namespace_create (&environment, "http://ws.apache.org/axis2/c/om", "axiom"); ns2 = - axis2_om_namespace_create (environment, "urn:ISBN:0-395-74341-6", + axis2_om_namespace_create (&environment, "urn:ISBN:0-395-74341-6", "isbn"); ns3 = - axis2_om_namespace_create (environment, "urn:w3-org-ns:HTML", "NULL"); + axis2_om_namespace_create (&environment, "urn:w3-org-ns:HTML", "NULL"); - ele1 = axis2_om_element_create (environment, NULL, "book", ns1, &node1); - /*axis2_om_element_declare_namespace(environment, node1, ns2); */ + ele1 = axis2_om_element_create (&environment, NULL, "book", ns1, &node1); + AXIS2_OM_ELEMENT_DECLARE_NAMESPACE(ele1,&environment,node1,ns2); + + ele2 = axis2_om_element_create (&environment, node1, "title", ns1, &node2); + + text1 = axis2_om_text_create (&environment, node2, "Axis2/C OM HOWTO", &node3); + + ele3 = axis2_om_element_create (&environment, node1, "number", ns2, &node4); + + text1 = axis2_om_text_create (&environment, node4, "1748491379", &node5); + + ele4 = axis2_om_element_create (&environment, node1, "author", ns1, &node6); + + attr1 = axis2_om_attribute_create (&environment, "title", "Mr", ns1); + + AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(ele4, &environment,attr1); + + attr2 = axis2_om_attribute_create (&environment, "name", "Axitoc Oman", ns1); + + AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(ele4,&environment, attr2); + + + /* serializing stuff */ + om_output = axis2_om_output_create (&environment, NULL, NULL); - ele2 = axis2_om_element_create (environment, node1, "title", ns1, &node2); - text1 = - axis2_om_text_create (environment, node2, "Axis2/C OM HOWTO", &node3); - - ele3 = - axis2_om_element_create (environment, node1, "number", ns2, &node4); - text1 = axis2_om_text_create (environment, node4, "1748491379", &node5); - - ele4 = - axis2_om_element_create (environment, node1, "author", ns1, &node6); - attr1 = axis2_om_attribute_create (environment, "title", "Mr", ns1); - axis2_om_element_add_attribute (environment, ele4, attr1); - attr2 = - axis2_om_attribute_create (environment, "name", "Axitoc Oman", ns1); - axis2_om_element_add_attribute (environment, ele4, attr2); - - - ele2 = axis2_om_element_create (environment, NULL, "notes", ns1, &node2); - ele3 = axis2_om_element_create (environment, node2, "p", ns3, &node3); - text1 = - axis2_om_text_create (environment, node3, - "This is vey good book on OM!", &node4); - - /*ele3 = axis2_om_element_create (NULL, "ele3", ns3 , &node3); */ - axis2_om_node_add_child (environment, node1, node2); - - /* serializing stuff */ - om_output = axis2_om_output_create (environment, NULL, NULL); - printf ("Serialize built document\n"); - int status = axis2_om_node_serialize (environment, node1, om_output); + int status = AXIS2_OM_NODE_SERIALIZE (node1,&environment ,om_output); if (status != AXIS2_SUCCESS) { printf ("\naxis2_om_node_serialize failed\n"); @@ -183,11 +182,9 @@ printf ("\naxis2_om_node_serialize success\n"); /* end serializing stuff */ - axis2_om_node_free (environment, node1); - axis2_free (environment->allocator, om_output); + + printf ("\nDONE\n"); - printf ("\nDONE\n"); - return 0; } @@ -198,8 +195,7 @@ if (argc > 1) file_name = argv[1]; allocator = axis2_allocator_init (NULL); - environment = - axis2_env_create (allocator, NULL, NULL, NULL, NULL); + environment = axis2_env_create (allocator); my_guththila_allocator = guththila_allocator_init (NULL); my_guththila_environment = @@ -207,5 +203,7 @@ NULL, NULL); test_om_build (file_name); - test_om_serialize (); + test_om_serialize (); + + } Index: test/om/src/test.xml =================================================================== --- test/om/src/test.xml (revision 332022) +++ test/om/src/test.xml (working copy) @@ -1,7 +1,6 @@ - - Axis2/C OM HOWTO + Axis2C OM HOWTO 1748491379 Index: xml/om/src/axis2_om_processing_instruction.c =================================================================== --- xml/om/src/axis2_om_processing_instruction.c (revision 332022) +++ xml/om/src/axis2_om_processing_instruction.c (working copy) @@ -199,4 +199,6 @@ { AXIS2_FUNC_PARAM_CHECK(om_pi, env, NULL); return AXIS2_INTF_TO_IMPL(om_pi)->target; -} \ No newline at end of file +} + + Index: xml/om/src/axis2_om_document.c =================================================================== --- xml/om/src/axis2_om_document.c (revision 332022) +++ xml/om/src/axis2_om_document.c (working copy) @@ -76,18 +76,19 @@ axis2_om_document_impl_t *document = NULL; AXIS2_ENV_CHECK(env, NULL); - + document = (axis2_om_document_impl_t *) AXIS2_MALLOC ( - (*env)->allocator, sizeof (axis2_om_document_t)); + (*env)->allocator, sizeof (axis2_om_document_impl_t)); if (!document) AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY,NULL); - + document->builder = builder; document->root_element = root; document->first_child = NULL; document->last_child = NULL; - + + document->char_set_encoding = NULL; document->char_set_encoding = (axis2_char_t *) AXIS2_STRDUP(CHAR_SET_ENCODING,env); @@ -101,26 +102,26 @@ document->xml_version = (axis2_char_t *) AXIS2_STRDUP(XML_VERSION,env); if (!document->xml_version) { + + AXIS2_FREE((*env)->allocator, document->char_set_encoding); AXIS2_FREE((*env)->allocator, document); - AXIS2_FREE((*env)->allocator, document->char_set_encoding); AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); } - + document->done = AXIS2_FALSE; - if (builder) - AXIS2_OM_STAX_BUILDER_SET_DOCUMENT (builder, env, &(document->om_document)); + - /* operations */ document->om_document.ops = NULL; document->om_document.ops = (axis2_om_document_ops_t *) AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_om_document_ops_t)); if (!document->om_document.ops) { - AXIS2_FREE((*env)->allocator, document); + AXIS2_FREE((*env)->allocator, document->char_set_encoding); AXIS2_FREE((*env)->allocator, document->xml_version); + AXIS2_FREE((*env)->allocator, document); AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); } @@ -129,6 +130,10 @@ document->om_document.ops->build_next = axis2_om_document_build_next; document->om_document.ops->get_root_element = axis2_om_document_get_root_element; document->om_document.ops->set_root_element = axis2_om_document_set_root_element; + + if (builder) + AXIS2_OM_STAX_BUILDER_SET_DOCUMENT (builder, env, &(document->om_document) ); + return &(document->om_document); } @@ -137,6 +142,7 @@ axis2_env_t **env) { axis2_om_document_impl_t *document = NULL; + AXIS2_FUNC_PARAM_CHECK(document, env, AXIS2_FAILURE); document = AXIS2_INTF_TO_IMPL(om_document); @@ -144,13 +150,13 @@ AXIS2_FREE((*env)->allocator, document->char_set_encoding); if (document->xml_version) AXIS2_FREE((*env)->allocator, document->xml_version); - + AXIS2_OM_NODE_FREE(document->root_element, env); if(document->om_document.ops) AXIS2_FREE((*env)->allocator, document->om_document.ops); - AXIS2_FREE((*env)->allocator, document); + AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(document)); return AXIS2_SUCCESS; } @@ -183,8 +189,10 @@ axis2_env_t **env) { axis2_om_document_impl_t *document = NULL; - AXIS2_FUNC_PARAM_CHECK(document, env, NULL); - + + + AXIS2_FUNC_PARAM_CHECK(om_document, env, NULL); + document = AXIS2_INTF_TO_IMPL(om_document); if (!(document->root_element)) @@ -202,21 +210,28 @@ axis2_om_document_get_root_element (axis2_om_document_t * document, axis2_env_t **env) { - axis2_om_node_t *node = NULL; AXIS2_FUNC_PARAM_CHECK(document, env, NULL); if (AXIS2_INTF_TO_IMPL(document)->root_element) { + + return AXIS2_INTF_TO_IMPL(document)->root_element; } else - { + { node = axis2_om_document_build_next(document, env); + if (AXIS2_INTF_TO_IMPL(document)->root_element) + { + return AXIS2_INTF_TO_IMPL(document)->root_element; + } else AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_DOCUMENT_STATE_ROOT_NULL, NULL); + + } } @@ -225,8 +240,9 @@ axis2_env_t **env, axis2_om_node_t *node) { + AXIS2_FUNC_PARAM_CHECK(document, env, AXIS2_FAILURE); AXIS2_PARAM_CHECK((*env)->error, node, AXIS2_FAILURE); AXIS2_INTF_TO_IMPL(document)->root_element = node; return AXIS2_SUCCESS; -} \ No newline at end of file +} Index: xml/om/src/axis2_om_comment.c =================================================================== --- xml/om/src/axis2_om_comment.c (revision 332022) +++ xml/om/src/axis2_om_comment.c (working copy) @@ -140,4 +140,4 @@ AXIS2_PARAM_CHECK((*env)->error, value, AXIS2_FAILURE); AXIS2_INTF_TO_IMPL(om_comment)->value = (axis2_char_t*)AXIS2_STRDUP(value,env); return AXIS2_SUCCESS; -} \ No newline at end of file +} Index: xml/om/src/axis2_om_attribute.c =================================================================== --- xml/om/src/axis2_om_attribute.c (revision 332022) +++ xml/om/src/axis2_om_attribute.c (working copy) @@ -138,9 +138,18 @@ AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE); return NULL; } - /* attribute->ops->free = axis2_om_attribute_impl_free; - attribute->ops->get_qname = axis2_om_attribute_impl_get_qname; - attribute->ops->serialize = axis2_om_attribute_impl_serialize; */ + attribute->om_attribute.ops->free = axis2_om_attribute_free; + attribute->om_attribute.ops->get_qname = axis2_om_attribute_get_qname; + attribute->om_attribute.ops->serialize = axis2_om_attribute_serialize; + + attribute->om_attribute.ops->get_localname = axis2_om_attribute_get_localname; + attribute->om_attribute.ops->get_value = axis2_om_attribute_get_value; + attribute->om_attribute.ops->get_namespace = axis2_om_attribute_get_namespace; + + attribute->om_attribute.ops->set_localname = axis2_om_attribute_set_localname; + attribute->om_attribute.ops->set_namespace = axis2_om_attribute_set_namespace; + attribute->om_attribute.ops->set_value = axis2_om_attribute_set_value; + return &(attribute->om_attribute); } @@ -214,13 +223,13 @@ attribute = AXIS2_INTF_TO_IMPL(om_attribute); if (attribute->ns && AXIS2_OM_NAMESPACE_GET_URI(attribute->ns,env) && - AXIS2_OM_NAMESPACE_GET_URI(attribute->ns,env)) + AXIS2_OM_NAMESPACE_GET_PREFIX(attribute->ns,env)) { status = axis2_om_output_write (om_output, env, AXIS2_OM_ATTRIBUTE, 4, attribute->localname, attribute->value, AXIS2_OM_NAMESPACE_GET_URI(attribute->ns, env), - AXIS2_OM_NAMESPACE_GET_URI(attribute->ns, env)); + AXIS2_OM_NAMESPACE_GET_PREFIX(attribute->ns, env)); } else if (attribute->ns && AXIS2_OM_NAMESPACE_GET_URI(attribute->ns,env)) { @@ -309,4 +318,4 @@ } AXIS2_INTF_TO_IMPL(om_attribute)->ns = om_namespace; return AXIS2_SUCCESS; -} \ No newline at end of file +} Index: xml/om/src/axis2_om_text.c =================================================================== --- xml/om/src/axis2_om_text.c (revision 332022) +++ xml/om/src/axis2_om_text.c (working copy) @@ -179,7 +179,5 @@ AXIS2_PARAM_CHECK((*env)->error , om_text, AXIS2_FAILURE); AXIS2_INTF_TO_IMPL(om_text)->value = (axis2_char_t*)AXIS2_STRDUP(value,env); return AXIS2_SUCCESS; -} - - - \ No newline at end of file +} + Index: xml/om/src/axis2_om_node.c =================================================================== --- xml/om/src/axis2_om_node.c (revision 332022) +++ xml/om/src/axis2_om_node.c (working copy) @@ -202,6 +202,7 @@ node->om_node.ops->set_parent = axis2_om_node_set_parent; node->om_node.ops->serialize = axis2_om_node_serialize; node->om_node.ops->iterator_get_next_child = axis2_om_node_iterator_get_next_child; + node->om_node.ops->get_first_child = axis2_om_node_get_first_child; node->om_node.ops->get_last_child = axis2_om_node_get_last_child; node->om_node.ops->get_next_sibling = axis2_om_node_get_next_sibling; @@ -209,9 +210,12 @@ node->om_node.ops->get_parent = axis2_om_node_get_parent ; node->om_node.ops->get_node_type = axis2_om_node_get_node_type; node->om_node.ops->get_build_status = axis2_om_node_get_build_status; + node->om_node.ops->get_data_element = axis2_om_node_get_data_element; + + + node->om_node.ops->set_data_element = axis2_om_node_set_data_element; node->om_node.ops->set_first_child = axis2_om_node_set_parent; node->om_node.ops->set_last_child = axis2_om_node_set_last_child; - node->om_node.ops->set_previous_sibling = axis2_om_node_set_previous_sibling; node->om_node.ops->set_next_sibling = axis2_om_node_set_next_sibling; node->om_node.ops->set_first_child = axis2_om_node_set_first_child; @@ -239,24 +243,26 @@ axis2_status_t AXIS2_CALL axis2_om_node_free(axis2_om_node_t *om_node,axis2_env_t **env) { - + printf("node free"); axis2_om_node_t *child_node = NULL; AXIS2_FUNC_PARAM_CHECK(om_node,env,AXIS2_FAILURE); - if ((AXIS2_INTF_TO_IMPL(om_node))->first_child) + if (AXIS2_INTF_TO_IMPL(om_node)->first_child) { - while (((axis2_om_node_impl_t*)om_node)->first_child) + while (AXIS2_INTF_TO_IMPL(om_node)->first_child) { - child_node = AXIS2_OM_NODE_DETACH (((axis2_om_node_impl_t*)om_node)->first_child, env); + child_node = AXIS2_OM_NODE_DETACH (AXIS2_INTF_TO_IMPL(om_node)->first_child, env); AXIS2_OM_NODE_FREE ( child_node , env); } - } - switch (((axis2_om_node_impl_t*)om_node)->node_type) + } + + switch (AXIS2_INTF_TO_IMPL(om_node)->node_type) { - case AXIS2_OM_ELEMENT: + case AXIS2_OM_ELEMENT: + printf(" om element free"); AXIS2_OM_ELEMENT_FREE((axis2_om_element_t*)(AXIS2_INTF_TO_IMPL(om_node)->data_element), env); break; @@ -276,9 +282,9 @@ default: break; } - + AXIS2_FREE ((*env)->allocator, om_node->ops); - AXIS2_FREE ((*env)->allocator, om_node); + AXIS2_FREE ((*env)->allocator, AXIS2_INTF_TO_IMPL(om_node)); return AXIS2_SUCCESS; @@ -542,12 +548,12 @@ return status; break; case AXIS2_OM_TEXT: - /* status = - axis2_om_text_serialize (environment, - (axis2_om_text_t *) om_node-> - data_element, om_output); + status = AXIS2_OM_TEXT_SERIALIZE ( + (axis2_om_text_t*)(AXIS2_INTF_TO_IMPL(om_node)->data_element), + env, + om_output); return status; - */ break; + break; default: break; @@ -639,7 +645,7 @@ axis2_env_t **env) { AXIS2_FUNC_PARAM_CHECK(om_node, env, NULL); - return AXIS2_INTF_TO_IMPL(om_node); + return AXIS2_INTF_TO_IMPL(om_node)->data_element; } axis2_status_t AXIS2_CALL @@ -717,6 +723,7 @@ axis2_env_t **env, void* data_element) { + AXIS2_FUNC_PARAM_CHECK(om_node, env, AXIS2_FAILURE); if(!data_element) @@ -747,4 +754,4 @@ AXIS2_FUNC_PARAM_CHECK(om_node, env, AXIS2_FAILURE); AXIS2_INTF_TO_IMPL(om_node)->done = done; return AXIS2_SUCCESS; -} \ No newline at end of file +} Index: xml/om/src/axis2_om_stax_builder.c =================================================================== --- xml/om/src/axis2_om_stax_builder.c (revision 332022) +++ xml/om/src/axis2_om_stax_builder.c (working copy) @@ -92,7 +92,7 @@ AXIS2_ENV_CHECK(env, NULL); builder = (axis2_om_stax_builder_impl_t *)AXIS2_MALLOC ( - (*env)->allocator, sizeof(axis2_om_stax_builder_t)); + (*env)->allocator, sizeof(axis2_om_stax_builder_impl_t)); if (!builder) AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); @@ -138,7 +138,7 @@ /* operations */ builder->om_stax_builder.ops = NULL; builder->om_stax_builder.ops = (axis2_om_stax_builder_ops_t *) AXIS2_MALLOC( - (*env)->allocator, sizeof(axis2_om_stax_builder_t)); + (*env)->allocator, sizeof(axis2_om_stax_builder_ops_t)); if (!builder->om_stax_builder.ops) { @@ -181,10 +181,10 @@ attribute_count = guththila_xml_pull_parser_get_attribute_count ( om_stax_builder_guththila_environment, builder->parser); - - for (i = 0; i < attribute_count; i++) + + for (i=1; i <= attribute_count ; i++) { - + uri = guththila_xml_pull_parser_get_attribute_namespace_by_number (om_stax_builder_guththila_environment, builder->parser, i); @@ -250,13 +250,14 @@ axis2_om_stax_builder_impl_t *builder = NULL; AXIS2_FUNC_PARAM_CHECK(om_stax_builder, env, NULL); - + builder = AXIS2_INTF_TO_IMPL(om_stax_builder); + if (!builder->lastnode) AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_BUILDER_STATE_LAST_NODE_NULL,NULL); - builder = AXIS2_INTF_TO_IMPL(om_stax_builder); + temp_value = guththila_xml_pull_parser_get_value ( om_stax_builder_guththila_environment, builder->parser); @@ -435,8 +436,8 @@ if (!(builder->lastnode)) { axis2_om_element_create (env , NULL, localname, NULL, &element_node); - /* should have a way to access documents root_element - without calling build next ???????????????? + + /* if (AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(builder->document, env)) AXIS2_OM_NODE_FREE ( AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(builder->document, env),env);*/ @@ -460,9 +461,10 @@ AXIS2_OM_NODE_SET_FIRST_CHILD(builder->lastnode , env, element_node); AXIS2_OM_NODE_SET_PARENT(element_node , env, builder->lastnode); } + axis2_om_stax_builder_process_attributes ( om_stax_builder, env, element_node); axis2_om_stax_builder_process_namespaces ( om_stax_builder, env, element_node, 0); - + builder->lastnode = element_node; /*axis2_free(environment->allocator, localname); */ @@ -506,6 +508,7 @@ { axis2_om_node_t *parent; axis2_om_stax_builder_impl_t *builder = NULL; + AXIS2_FUNC_PARAM_CHECK(om_stax_builder, env, AXIS2_FAILURE ); builder = AXIS2_INTF_TO_IMPL(om_stax_builder); @@ -518,7 +521,7 @@ if (parent) { AXIS2_OM_NODE_SET_BUILD_STATUS(parent, env, AXIS2_TRUE); - AXIS2_OM_NODE_SET_PARENT((builder->lastnode), env, parent); + builder->lastnode= parent; } } else @@ -563,12 +566,13 @@ /*Do nothing */ break; case GUTHTHILA_START_ELEMENT: - /* node = axis2_om_stax_builder_create_om_element ( - om_stax_builder, env); */ + + node = axis2_om_stax_builder_create_om_element ( + om_stax_builder, env); break; case GUTHTHILA_EMPTY_ELEMENT: - /* node = axis2_om_stax_builder_create_om_element ( - om_stax_builder, env); */ + node = axis2_om_stax_builder_create_om_element ( + om_stax_builder, env); case GUTHTHILA_END_ELEMENT: axis2_om_stax_builder_end_element (om_stax_builder, env); break; @@ -644,8 +648,10 @@ axis2_env_t **env, axis2_om_document_t *document) { + AXIS2_FUNC_PARAM_CHECK(builder,env,AXIS2_FAILURE); AXIS2_PARAM_CHECK((*env)->error, document , AXIS2_FAILURE); AXIS2_INTF_TO_IMPL(builder)->document = document ; + return AXIS2_SUCCESS; -} \ No newline at end of file +} Index: xml/om/src/axis2_om_doctype.c =================================================================== --- xml/om/src/axis2_om_doctype.c (revision 332022) +++ xml/om/src/axis2_om_doctype.c (working copy) @@ -147,4 +147,6 @@ { AXIS2_FUNC_PARAM_CHECK(om_doctype, env, NULL); return AXIS2_INTF_TO_IMPL(om_doctype)->value; -} \ No newline at end of file +} + + Index: xml/om/src/axis2_om_element.c =================================================================== --- xml/om/src/axis2_om_element.c (revision 332022) +++ xml/om/src/axis2_om_element.c (working copy) @@ -218,6 +218,17 @@ element->om_element.ops->serialize_end_part = axis2_om_element_serialize_end_part; + element->om_element.ops->set_localname = + axis2_om_element_set_localname; + element->om_element.ops->set_namespace = + axis2_om_element_set_namespace; + + element->om_element.ops->get_localname = + axis2_om_element_get_localname; + + element->om_element.ops->get_namespace = + axis2_om_element_get_namespace; + return &(element->om_element); } @@ -454,6 +465,7 @@ axis2_env_t **env, axis2_om_attribute_t *attribute) { + axis2_qname_t *qname = NULL; AXIS2_FUNC_PARAM_CHECK(om_element, env, AXIS2_FAILURE); if (!attribute) @@ -466,6 +478,7 @@ if (!(AXIS2_INTF_TO_IMPL(om_element)->attributes)) { + AXIS2_INTF_TO_IMPL(om_element)->attributes = axis2_hash_make (env); if (!(AXIS2_INTF_TO_IMPL(om_element)->attributes)) return AXIS2_FAILURE; @@ -691,15 +704,20 @@ axis2_om_node_t *node) { axis2_om_namespace_t *om_ns = NULL; - axis2_status_t status; + axis2_status_t status = AXIS2_FAILURE; AXIS2_FUNC_PARAM_CHECK(om_element, env, AXIS2_FAILURE); AXIS2_PARAM_CHECK((*env)->error,ns , AXIS2_FAILURE); + om_ns = axis2_om_element_find_namespace(om_element,env,node, AXIS2_OM_NAMESPACE_GET_URI(ns, env), AXIS2_OM_NAMESPACE_GET_PREFIX(ns , env)); - if(om_ns == NULL) + if(!om_ns) + { status = axis2_om_element_declare_namespace(om_element, env, node, ns); - if(status = AXIS2_SUCCESS) + AXIS2_INTF_TO_IMPL(om_element)->ns = ns; + } + else AXIS2_INTF_TO_IMPL(om_element)->ns = om_ns; + return AXIS2_SUCCESS; -} \ No newline at end of file +} Index: xml/om/src/axis2_om_namespace.c =================================================================== --- xml/om/src/axis2_om_namespace.c (revision 332022) +++ xml/om/src/axis2_om_namespace.c (working copy) @@ -285,4 +285,4 @@ } AXIS2_INTF_TO_IMPL(om_namespace)->prefix = (axis2_char_t*)AXIS2_STRDUP(prefix,env); return AXIS2_SUCCESS; -} \ No newline at end of file +} ------=_Part_11481_27088583.1131590880027--