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 ka...@apache.org on 2007/02/15 09:37:55 UTC

svn commit: r507853 - in /webservices/axis2/trunk/c/rampart: include/oxs_c14n.h src/omxmlsec/c14n/c14n.c test/c14n/res/d.xml test/c14n/res/f.xml test/c14n/test.c

Author: kaushalye
Date: Thu Feb 15 00:37:53 2007
New Revision: 507853

URL: http://svn.apache.org/viewvc?view=rev&rev=507853
Log:
Applying patch for c14n document subset support. JIRA AXIS2C-511


Modified:
    webservices/axis2/trunk/c/rampart/include/oxs_c14n.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c
    webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml
    webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml
    webservices/axis2/trunk/c/rampart/test/c14n/test.c

Modified: webservices/axis2/trunk/c/rampart/include/oxs_c14n.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_c14n.h?view=diff&rev=507853&r1=507852&r2=507853
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_c14n.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_c14n.h Thu Feb 15 00:37:53 2007
@@ -42,6 +42,7 @@
 extern "C"
 {
 #endif
+
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
     oxs_c14n_apply_stream(
         const axis2_env_t *env,
@@ -49,7 +50,8 @@
         axis2_bool_t comments,
         axis2_stream_t *stream,
         const axis2_bool_t exclusive,
-        const axis2_array_list_t *ns_prefixes
+        const axis2_array_list_t *ns_prefixes,
+        const axiom_node_t *node
         );
 
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -59,7 +61,8 @@
         const axis2_bool_t comments,
         axis2_char_t **outbuf,
         const axis2_bool_t exclusive,
-        const axis2_array_list_t *ns_prefixes
+        const axis2_array_list_t *ns_prefixes,
+        const axiom_node_t *node
         );
 
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c?view=diff&rev=507853&r1=507852&r2=507853
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c Thu Feb 15 00:37:53 2007
@@ -67,6 +67,7 @@
     axis2_bool_t exclusive;
     axis2_bool_t use_stream;
     const axis2_array_list_t *ns_prefixes;
+    const axiom_node_t *node;
     c14n_ns_stack_t *ns_stack;
 } c14n_ctx_t;
 
@@ -366,6 +367,13 @@
     const c14n_ctx_t *ctx
     );
 
+/*static axis2_bool_t
+c14n_in_nodeset(
+    const axiom_node_t *node,
+    const c14n_ctx_t *ctx
+    );
+*/
+
 /* Implementations */
 
 static void
@@ -390,7 +398,8 @@
     axis2_stream_t *stream,
     const axis2_bool_t exclusive,
     const axis2_array_list_t *ns_prefixes,
-    const axis2_bool_t use_stream
+    const axis2_bool_t use_stream,
+    const axiom_node_t *node
     )
 {
     c14n_ctx_t *ctx = (c14n_ctx_t *)(AXIS2_MALLOC(env->allocator, 
@@ -404,6 +413,7 @@
         ctx->exclusive = exclusive;
         ctx->ns_prefixes = ns_prefixes;
         ctx->use_stream = use_stream;
+        ctx->node = node;
         if (use_stream)
             ctx->outstream = stream;
 
@@ -416,6 +426,17 @@
     return ctx;
 }
 
+/*static axis2_bool_t
+c14n_in_nodeset(
+    const axiom_node_t *node,
+    const c14n_ctx_t *ctx
+    )
+{
+    
+    return AXIS2_SUCCESS;
+}*/
+
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_c14n_apply_stream(
     const axis2_env_t *env,
@@ -423,7 +444,8 @@
     axis2_bool_t comments,
     axis2_stream_t *stream,
     const axis2_bool_t exclusive,
-    const axis2_array_list_t *ns_prefixes
+    const axis2_array_list_t *ns_prefixes,
+    const axiom_node_t *node
     )
 {
     c14n_ctx_t *ctx = NULL;
@@ -434,17 +456,18 @@
     axis2_stream_t *outstream = NULL;
 
     ctx = c14n_init(env, doc, comments, NULL, stream, exclusive, ns_prefixes,
-            AXIS2_TRUE);
+            AXIS2_TRUE, node);
 
     if (ctx && ctx->outstream)
     {
 
         root_node = AXIOM_DOCUMENT_GET_ROOT_ELEMENT((axiom_document_t *)doc,
                 env); 
+
         /* shouldn't the called method's document be const?*/
 
         root_ele = AXIOM_NODE_GET_DATA_ELEMENT(root_node, env);
-        status = c14n_apply_on_node(root_node, ctx);
+        status = c14n_apply_on_node((node ? node : root_node), ctx);
         
         if (!status)
         {
@@ -516,12 +539,13 @@
     axis2_bool_t comments,
     axis2_char_t **outbuf,
     const axis2_bool_t exclusive,
-    const axis2_array_list_t *ns_prefixes
+    const axis2_array_list_t *ns_prefixes,
+    const axiom_node_t *node
     )
 {
     axis2_stream_t *stream = axis2_stream_create_basic(env);
     axis2_status_t ret = oxs_c14n_apply_stream(env, doc, comments, 
-            stream, exclusive, ns_prefixes);
+            stream, exclusive, ns_prefixes, node);
 
     *outbuf = NULL;
 
@@ -677,7 +701,8 @@
     /*c14n_output("\n", ctx);*/
 #endif
 
-    /**/
+    /*process child elements*/
+    
     axiom_node_t *child_node = NULL;
     child_node = AXIOM_NODE_GET_FIRST_CHILD((axiom_node_t *)node, ctx->env);
 

Modified: webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml?view=diff&rev=507853&r1=507852&r2=507853
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml (original)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml Thu Feb 15 00:37:53 2007
@@ -5,5 +5,5 @@
         a:attr1="one"         b:attr2='two' a:attr2="three"/>
     <test:f id=' &apos; &amp;  &#x20;&#13;&#xa;&#9;  &apos; '/>
     <g> &apos; &amp;  &#x20;&#13;&#xa;&#9;  &apos; </g>
-</doc>
 <!--this is a comment outside-->
+</doc>

Modified: webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml?view=diff&rev=507853&r1=507852&r2=507853
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml (original)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml Thu Feb 15 00:37:53 2007
@@ -4,7 +4,6 @@
             <e3 id="E3"/>
         </e2>
 	</e1>
+<!--(//. | //@* | //namespace::*)[self::e1 or (parent::e1 and not(self::text() or self::e2)) or count(id("E3")|ancestor-or-self::node()) = count(ancestor-or-self::node())]-->
 </doc>
 
-
-<!--(//. | //@* | //namespace::*)[self::e1 or (parent::e1 and not(self::text() or self::e2)) or count(id("E3")|ancestor-or-self::node()) = count(ancestor-or-self::node())]-->
\ No newline at end of file

Modified: webservices/axis2/trunk/c/rampart/test/c14n/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/test.c?view=diff&rev=507853&r1=507852&r2=507853
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/test.c (original)
+++ webservices/axis2/trunk/c/rampart/test/c14n/test.c Thu Feb 15 00:37:53 2007
@@ -83,7 +83,7 @@
     if (!om_builder) { p_fail(); return 1; }
 
     doc = AXIOM_STAX_BUILDER_GET_DOCUMENT(om_builder, env);
-    
+    AXIOM_DOCUMENT_BUILD_ALL (doc, env); 
     if (!doc) { p_fail(); return 1; }
     axis2_char_t *txt = NULL;
     /*res = oxs_c14n_apply(env, doc, AXIS2_TRUE, &txt, AXIS2_FALSE, NULL);
@@ -93,10 +93,13 @@
     
     stream = axis2_stream_create_basic(env);
     
+    axiom_node_t *root_node = AXIOM_DOCUMENT_GET_ROOT_ELEMENT(doc, env);
+    axiom_node_t *c14n_node = AXIOM_NODE_GET_FIRST_ELEMENT(root_node, env);
+
     if (argc>2 && !(argv[2][0]-'e'))
-        res = oxs_c14n_apply_stream(env, doc, AXIS2_TRUE, stream, AXIS2_TRUE , NULL);
+        res = oxs_c14n_apply_stream(env, doc, AXIS2_TRUE, stream, AXIS2_TRUE , NULL, c14n_node);
     else
-        res = oxs_c14n_apply_stream(env, doc, AXIS2_TRUE, stream, AXIS2_FALSE , NULL);
+        res = oxs_c14n_apply_stream(env, doc, AXIS2_TRUE, stream, AXIS2_FALSE , NULL, c14n_node);
 
     if (!res) return -1; /*error occured!*/
 
@@ -136,6 +139,6 @@
         env = NULL;
     }
 
-    printf("\n");
+    /*printf("\n");*/
     return 0;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org