You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/09/30 06:57:40 UTC
svn commit: r292633 - in /webservices/axis2/trunk/c/modules/xml/om:
project.properties src/axis2c_node.c
Author: samisa
Date: Thu Sep 29 21:57:33 2005
New Revision: 292633
URL: http://svn.apache.org/viewcvs?rev=292633&view=rev
Log:
applied the patch by nandika , axis2c_node.c functions changed
Modified:
webservices/axis2/trunk/c/modules/xml/om/project.properties
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c
Modified: webservices/axis2/trunk/c/modules/xml/om/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/project.properties?rev=292633&r1=292632&r2=292633&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/project.properties (original)
+++ webservices/axis2/trunk/c/modules/xml/om/project.properties Thu Sep 29 21:57:33 2005
@@ -17,5 +17,5 @@
freehep.nar.src=src
freehep.nar.outtype=shared
freehep.nar.test.src=test
-freehep.nar.tests=om_test
+freehep.nar.tests=
freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-xml-om-nar-0.0
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c?rev=292633&r1=292632&r2=292633&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c Thu Sep 29 21:57:33 2005
@@ -61,43 +61,108 @@
-axis2c_node_t *axis2c_detach_node(axis2c_node_t * axis2c_node_to_detach)
+axis2c_node_t *axis2c_node_detach(axis2c_node_t * node_to_detach)
{
axis2c_node_t *parent = NULL;
axis2c_node_t *next_sibling = NULL;
- if (!axis2c_node_to_detach)
+ if (!node_to_detach)
{
- return NULL;
+ return NULL;
}
- if (!(axis2c_node_to_detach->parent))
+ if (!(node_to_detach->parent))
{
/* nodes that do not have a parent can't be detached
*/
- return NULL;
+ return NULL;
}
- parent = axis2c_node_to_detach->parent;
- if ((axis2c_node_to_detach->prev_sibling) == NULL)
+ parent = node_to_detach->parent;
+
+ if ((node_to_detach->prev_sibling) == NULL)
{
- parent->first_child = axis2c_node_to_detach->next_sibling;
- } else
+ parent->first_child = node_to_detach->next_sibling;
+ }
+ else
{
- axis2c_node_to_detach->prev_sibling->next_sibling =
- axis2c_node_to_detach->next_sibling;
+ node_to_detach->prev_sibling->next_sibling =
+ node_to_detach->next_sibling;
}
- if (!(axis2c_node_to_detach->next_sibling))
+ if (!(node_to_detach->next_sibling))
{
- axis2c_node_to_detach->next_sibling->prev_sibling =
- axis2c_node_to_detach->prev_sibling;
+ node_to_detach->next_sibling->prev_sibling =
+ node_to_detach->prev_sibling;
}
- axis2c_node_to_detach->parent = NULL;
+ node_to_detach->parent = NULL;
- return axis2c_node_to_detach;
+ return node_to_detach;
}
-void axis2c_node_set_parent(axis2c_node_t * node)
+void axis2c_node_set_parent(axis2c_node_t * node,axis2c_node_t *parent)
{
+ if(!parent || !node)
+ {/*null pointers */
+ return ;
+ }
+
+ if(parent == node->parent )
+ {/* same parent already exist */
+ return ;
+ }
+ /* if a new parent is assigned in place of existing one first the node should be detached */
+
+ if(!(node->parent))
+ {
+ axis2c_node_detach(node);
+ }
+ node->parent = parent;
+}
+/**
+ * This will insert a sibling just after the current information item
+ *@param node the node in consideration
+ *@param nodeto_insert the node that will be inserted
+ */
+void axis2c_node_insert_sibling_after(axis2c_node_t *node,axis2c_node_t *nodeto_insert)
+{
+ if(!node || !nodeto_insert )
+ {
+ return ;
+ }
+ nodeto_insert->parent = node->parent;
+ nodeto_insert->prev_sibling = node;
+
+ if(node->next_sibling)
+ {
+ node->next_sibling->prev_sibling = nodeto_insert;
+ }
+ nodeto_insert->next_sibling = node->next_sibling;
+ node->next_sibling = nodeto_insert;
+}
+
+void axis2c_node_insert_sibling_before(axis2c_node_t *node,axis2c_node_t *nodeto_insert)
+{
+ if(!node || !nodeto_insert )
+ {
+ return;
+ }
+
+ nodeto_insert->parent = node->parent;
+
+ nodeto_insert->prev_sibling = node->prev_sibling;
+ nodeto_insert->next_sibling = node;
+
+ if(!(node->prev_sibling))
+ {
+ node->parent->first_child = nodeto_insert;
+ }
+ else
+ {
+ node->prev_sibling->next_sibling = nodeto_insert;
+
+ }
+ node->prev_sibling = nodeto_insert;
}
+
+