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 di...@apache.org on 2008/01/30 12:08:39 UTC

svn commit: r616723 - in /webservices/axis2/trunk/c/guththila: include/guththila_token.h src/guththila_token.c src/guththila_xml_parser.c

Author: dinesh
Date: Wed Jan 30 03:08:38 2008
New Revision: 616723

URL: http://svn.apache.org/viewvc?rev=616723&view=rev
Log:
fixed axis2c-857, guththila parser drops xml:id attributes from incoming elements

Modified:
    webservices/axis2/trunk/c/guththila/include/guththila_token.h
    webservices/axis2/trunk/c/guththila/src/guththila_token.c
    webservices/axis2/trunk/c/guththila/src/guththila_xml_parser.c

Modified: webservices/axis2/trunk/c/guththila/include/guththila_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/guththila/include/guththila_token.h?rev=616723&r1=616722&r2=616723&view=diff
==============================================================================
--- webservices/axis2/trunk/c/guththila/include/guththila_token.h (original)
+++ webservices/axis2/trunk/c/guththila/include/guththila_token.h Wed Jan 30 03:08:38 2008
@@ -75,9 +75,11 @@
 
 #ifndef GUTHTHILA_TOKEN_TO_STRING
 #define GUTHTHILA_TOKEN_TO_STRING(tok, string, _env) \
-string  = (guththila_char_t *) AXIS2_MALLOC(_env->allocator, (GUTHTHILA_TOKEN_LEN(tok) + 1) * sizeof(guththila_char_t)); \
-    memcpy(string, (tok)->start, GUTHTHILA_TOKEN_LEN(tok)); \
-    string[GUTHTHILA_TOKEN_LEN(tok)] = 0; 
+    { \
+        string  = (guththila_char_t *) AXIS2_MALLOC(_env->allocator, (GUTHTHILA_TOKEN_LEN(tok) + 1) * sizeof(guththila_char_t)); \
+        memcpy(string, (tok)->start, GUTHTHILA_TOKEN_LEN(tok));         \
+        string[GUTHTHILA_TOKEN_LEN(tok)] = 0; \
+    }
 #endif  /*  */
 
 guththila_tok_list_t *
@@ -117,6 +119,15 @@
     guththila_token_t * tok1,
     guththila_token_t * tok2,
     const axutil_env_t * env);
+guththila_token_t* GUTHTHILA_CALL
+guththila_token_create(
+    guththila_char_t* start,
+    short type,
+    int size,
+    int _start,
+    int last,
+    int ref,
+    const axutil_env_t* env);
 EXTERN_C_END() 
 #endif  /*  */
 

Modified: webservices/axis2/trunk/c/guththila/src/guththila_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/guththila/src/guththila_token.c?rev=616723&r1=616722&r2=616723&view=diff
==============================================================================
--- webservices/axis2/trunk/c/guththila/src/guththila_token.c (original)
+++ webservices/axis2/trunk/c/guththila/src/guththila_token.c Wed Jan 30 03:08:38 2008
@@ -217,9 +217,9 @@
     const axutil_env_t * env) 
 {
     unsigned int i = 0;
-    if (tok1->size != tok2->size)
-        return -1;
-    for (; i < tok1->size; i++)
+
+
+    if (tok1 && tok2)
     {
         if (tok1->start[i] != tok2->start[i])
         {
@@ -228,6 +228,34 @@
     }
     return 0;
 }
+guththila_token_t* GUTHTHILA_CALL
+guththila_token_create(guththila_char_t* start,
+                       short type,
+                       int size,
+                       int _start,
+                       int last,
+                       int ref,
+                       const axutil_env_t* env)
+{
+    guththila_token_t* tok;
+    tok = (guththila_token_t *) AXIS2_MALLOC(env->allocator,sizeof(guththila_token_t));
+    if (!tok)
+        return NULL;
+    tok->start  =  (guththila_char_t*) AXIS2_MALLOC(env->allocator,size);
+    if (!tok->start)
+    {
+        AXIS2_FREE(env->allocator, tok);
+        return NULL;
+    }
+    memcpy(tok->start,start,size);
+    tok->type = type;
+    tok->_start = _start;
+    tok->size = size;
+    tok->last = last;
+    tok->ref = ref;
+    return tok;
+}
+ 
 
 
 

Modified: webservices/axis2/trunk/c/guththila/src/guththila_xml_parser.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/guththila/src/guththila_xml_parser.c?rev=616723&r1=616722&r2=616723&view=diff
==============================================================================
--- webservices/axis2/trunk/c/guththila/src/guththila_xml_parser.c (original)
+++ webservices/axis2/trunk/c/guththila/src/guththila_xml_parser.c Wed Jan 30 03:08:38 2008
@@ -55,7 +55,15 @@
 #ifndef GUTHTHILA_SKIP_SPACES_WITH_NEW_LINE
 #define GUTHTHILA_SKIP_SPACES_WITH_NEW_LINE(m, c, _env) while (0x20 == c || 0x9 == c || 0xD == c || 0xA == c || '\n' == c){c = guththila_next_char(m, 0, _env);}
 #endif  
-    
+
+#ifndef GUTHTHILA_XML_NAME
+#define GUTHTHILA_XML_NAME "xml"
+#endif
+
+#ifndef GUTHTHILA_XML_URI
+#define GUTHTHILA_XML_URI "http://www.w3.org/XML/1998/namespace"
+#endif    
+
 #ifndef GUTHTHILA_LAST_CHAR
 #define GUTHTHILA_LAST_CHAR(m) (m->buffer.buff + m->buffer.next - 1)
 #endif  
@@ -286,6 +294,10 @@
 GUTHTHILA_EXPORT int GUTHTHILA_CALL
 guththila_init(guththila_t * m, void *reader, const axutil_env_t * env) 
 {
+    guththila_token_t* temp_name = NULL;
+    guththila_token_t* temp_tok = NULL;
+    guththila_elem_namesp_t* e_namesp = NULL;
+
     if (!((guththila_reader_t *) reader))
         return GUTHTHILA_FAILURE;
     m->reader = (guththila_reader_t *) reader;
@@ -305,6 +317,83 @@
     guththila_stack_init(&m->elem, env);
     guththila_stack_init(&m->attrib, env);
     guththila_stack_init(&m->namesp, env);
+    temp_name = guththila_token_create(GUTHTHILA_XML_NAME,0,strlen(GUTHTHILA_XML_NAME),
+                                       1,0,0,env);
+    temp_tok = guththila_token_create(GUTHTHILA_XML_URI,0,strlen(GUTHTHILA_XML_URI),
+                                      1,0,0,env);
+    e_namesp = (guththila_elem_namesp_t *) AXIS2_MALLOC(env->allocator,
+                                                        sizeof(guththila_elem_namesp_t));
+    if (e_namesp && temp_tok && temp_name)
+    {
+        e_namesp->namesp =
+            (guththila_namespace_t *) AXIS2_MALLOC(env->allocator,
+                                                   sizeof(guththila_namespace_t) * GUTHTHILA_NAMESPACE_DEF_SIZE);
+    }
+    if (e_namesp->namesp)
+    {
+        e_namesp->no = 1;
+        e_namesp->size = GUTHTHILA_NAMESPACE_DEF_SIZE;
+        e_namesp->namesp[0].name = temp_name;
+        e_namesp->namesp[0].uri = temp_tok;
+        guththila_stack_push(&m->namesp, e_namesp, env);
+    }
+    else
+    {
+        if (temp_name)
+        {
+            AXIS2_FREE(env->allocator, temp_name);
+            temp_name = NULL;
+        }
+        if (temp_tok)
+        {
+            AXIS2_FREE(env->allocator, temp_tok);
+            temp_tok = NULL;
+        }
+        if (e_namesp)
+        {
+            AXIS2_FREE(env->allocator, e_namesp);
+            e_namesp = NULL;
+        }
+        return GUTHTHILA_FAILURE;
+    }temp_name = guththila_token_create(GUTHTHILA_XML_NAME,0,strlen(GUTHTHILA_XML_NAME),
+                                        1,0,0,env);
+    temp_tok = guththila_token_create(GUTHTHILA_XML_URI,0,strlen(GUTHTHILA_XML_URI),
+                                      1,0,0,env);
+    e_namesp = (guththila_elem_namesp_t *) AXIS2_MALLOC(env->allocator,
+                                                        sizeof(guththila_elem_namesp_t));
+    if (e_namesp && temp_tok && temp_name)
+    {
+        e_namesp->namesp =
+            (guththila_namespace_t *) AXIS2_MALLOC(env->allocator,
+                                                   sizeof(guththila_namespace_t) * GUTHTHILA_NAMESPACE_DEF_SIZE);
+    }
+    if (e_namesp->namesp)
+    {
+        e_namesp->no = 1;
+        e_namesp->size = GUTHTHILA_NAMESPACE_DEF_SIZE;
+        e_namesp->namesp[0].name = temp_name;
+        e_namesp->namesp[0].uri = temp_tok;
+        guththila_stack_push(&m->namesp, e_namesp, env);
+    }
+    else
+    {
+        if (temp_name)
+        {
+            AXIS2_FREE(env->allocator, temp_name);
+            temp_name = NULL;
+        }
+        if (temp_tok)
+        {
+            AXIS2_FREE(env->allocator, temp_tok);
+            temp_tok = NULL;
+        }
+        if (e_namesp)
+        {
+            AXIS2_FREE(env->allocator, e_namesp);
+            e_namesp = NULL;
+        }
+        return GUTHTHILA_FAILURE;
+    }
     m->name = NULL;
     m->prefix = NULL;
     m->value = NULL;



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