axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r292082 - in /webservices/axis2/trunk/c/modules/xml/guththila/src: response.xml stack.h token.c token.h xmlpullparser.c xmlpullparser.h
Date Wed, 28 Sep 2005 01:42:36 GMT
Author: samisa
Date: Tue Sep 27 18:42:26 2005
New Revision: 292082

URL: http://svn.apache.org/viewcvs?rev=292082&view=rev
Log:
Applied patch by Dinesh

Modified:
    webservices/axis2/trunk/c/modules/xml/guththila/src/response.xml
    webservices/axis2/trunk/c/modules/xml/guththila/src/stack.h
    webservices/axis2/trunk/c/modules/xml/guththila/src/token.c
    webservices/axis2/trunk/c/modules/xml/guththila/src/token.h
    webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.c
    webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.h

Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/response.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/response.xml?rev=292082&r1=292081&r2=292082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/response.xml (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/response.xml Tue Sep 27 18:42:26 2005
@@ -6,7 +6,7 @@
 now we want to test it more
 Because each XML entity not accompanied by external encoding information and not in  UTF-8
and UTF-16 encoding must begin with an XML encoding declaration, in which the first characters
must be -
 -->
-<addReturn xsi:type="xsd:int">28</addReturn>
+<addReturn xsi:type="xsd:int">dinesh &amp; test &gt;&lt;&quot;&apos;
test1</addReturn>
 <!-- this is a comments -->
 </ns1:addResponse>
 <!-- this is a comments -->

Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/stack.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/stack.h?rev=292082&r1=292081&r2=292082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/stack.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/stack.h Tue Sep 27 18:42:26 2005
@@ -41,7 +41,7 @@
   NAMESPACE *namespace;
   DEPTH *depth;
   ELEMENT *prev;
-} element;
+};
 
 typedef struct stack
 {

Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/token.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/token.c?rev=292082&r1=292081&r2=292082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/token.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/token.c Tue Sep 27 18:42:26 2005
@@ -90,6 +90,67 @@
   return tok->last;
 }
 
+char*
+Token_char_ref (char *buffer)
+{
+  int len;
+  int ii;
+  int ix;
+  len = strlen (buffer);
+  char *ref_buffer = (char *) malloc (len+1);
+  for (ii = 0, ix = 0; ii < len; ii++, ix++)
+    {
+      if (buffer[ii] == '&')
+	{
+	  if (buffer[ii+1] == 'a' 
+	      && buffer[ii+2] == 'm'
+	      && buffer[ii+3] == 'p'
+	      && buffer[ii+4] == ';')
+	    {
+	      ref_buffer[ix] = '&';
+	      ii += 4;
+	    }
+	  else if (buffer[ii+1] == 'g'
+		   && buffer[ii+2] == 't'
+		   && buffer[ii+3] == ';')
+	    {
+	      ref_buffer[ix] = '>';
+	      ii += 3;
+	    }
+	  else if (buffer[ii+1] == 'l'
+		   && buffer[ii+2] == 't'
+		   && buffer[ii+3] == ';')
+	    {
+	      ref_buffer[ix] = '<';
+	      ii += 3;
+	    }
+	  else if (buffer[ii+1] == 'q'
+		   && buffer[ii+2] == 'u'
+		   && buffer[ii+3] == 'o'
+		   && buffer[ii+4] == 't'
+		   && buffer[ii+5] == ';')
+	    {
+	      ref_buffer[ix] = '"';
+	      ii +=5;
+	    }
+	  else if (buffer[ii+1] == 'a'
+		   && buffer[ii+2] == 'p'
+		   && buffer[ii+3] == 'o'
+		   && buffer[ii+4] == 's'
+		   && buffer[ii+5] == ';')
+	    {
+	      ref_buffer[ix] = '\'';
+	      ii +=5;
+	    }
+	  else 
+	    Token_Exception ();
+	}
+      else
+	ref_buffer[ix] = buffer[ii];
+    }
+  return ref_buffer;
+}
+
 
 char *
 Token_toString (TOKEN *tok, int unicode)
@@ -104,7 +165,10 @@
 	  buffer = (char *) malloc (length + 1);
 	  memcpy (buffer, tok->start, length);
 	  buffer[length] = 0;
-	  return buffer;
+	  if (tok->ref)
+	    Token_char_ref (buffer);
+	  else
+	    return buffer;
 	}
       else
 	{

Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/token.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/token.h?rev=292082&r1=292081&r2=292082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/token.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/token.h Tue Sep 27 18:42:26 2005
@@ -31,6 +31,7 @@
   char *end;
   int last;
   int size;
+  int ref;
 }TOKEN;
 
 
@@ -62,4 +63,5 @@
 char *Token_convert_utf16_to_utf8 (char *buffer, int length);
 int Token_length_utf16 (unsigned int utf16_ch);
 char *Token_build_utf8 (unsigned int utf16_ch, int length);
+char *Token_char_ref (char *buffer);
 #endif

Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.c?rev=292082&r1=292081&r2=292082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.c Tue Sep 27 18:42:26
2005
@@ -198,10 +198,11 @@
 
 
 PRIVATE void
-XML_PullParser_closeToken (XML_PullParser *parser, int t)
+XML_PullParser_closeToken (XML_PullParser *parser, int t, int refer)
 {
   ELEMENT *e= Stack_last (parser->stack);
   e->token->type = t;
+  e->token->ref = refer;
   e->token->end = XML_PullParser_lastChar (parser)-1;
 }
 
@@ -249,14 +250,14 @@
 	  && 'n' == XML_PullParser_nextChar (parser, 0))
 	{
 	  ic = XML_PullParser_nextChar (parser, 0);
-	  XML_PullParser_closeToken (parser, Attribute);
+	  XML_PullParser_closeToken (parser, Attribute, 0);
 	  quote = XML_PullParser_processEq (parser, ic);
 	  nc = XML_PullParser_nextChar (parser, 0); 
 	  /* 0, since we don't expect EOF line here */
 	  XML_PullParser_openToken (parser);
 	  while ( quote != nc)
 	    nc = XML_PullParser_nextChar (parser, 0);
-	  XML_PullParser_closeToken (parser, AttValue);
+	  XML_PullParser_closeToken (parser, AttValue, 0);
 	  nc = XML_PullParser_nextChar (parser, 0);
 	  return XML_PullParser_skipS (parser, nc);
 	}
@@ -285,13 +286,13 @@
        && 'g' == XML_PullParser_nextChar (parser, 0))
     {
       ic = XML_PullParser_nextChar (parser, 0);
-      XML_PullParser_closeToken (parser, Attribute);
+      XML_PullParser_closeToken (parser, Attribute, 0);
       quote = XML_PullParser_processEq (parser, ic);
       nc = XML_PullParser_nextChar (parser, 0);
       XML_PullParser_openToken (parser);
       while (quote != nc)
 	nc = XML_PullParser_nextChar (parser, 0);
-      XML_PullParser_closeToken (parser, AttValue);
+      XML_PullParser_closeToken (parser, AttValue, 0);
       nc = XML_PullParser_nextChar (parser, 0);
       return XML_PullParser_skipS (parser, nc);
     }
@@ -318,7 +319,7 @@
        && 'n' == XML_PullParser_nextChar (parser, 0)
        && 'e' == XML_PullParser_nextChar (parser, 0))
   ic = XML_PullParser_nextChar (parser, 0);
-  XML_PullParser_closeToken (parser, Attribute);
+  XML_PullParser_closeToken (parser, Attribute, 0);
   quote = XML_PullParser_processEq (parser, ic);
   nc = XML_PullParser_nextChar (parser, 0);
   XML_PullParser_openToken (parser);
@@ -342,7 +343,7 @@
       else
 	XML_PullParser_Exception (p_FILE, LINE);
     }
-  XML_PullParser_closeToken (parser, AttValue);
+  XML_PullParser_closeToken (parser, AttValue, 0);
   nc = XML_PullParser_nextChar (parser, 0);
   return XML_PullParser_skipS (parser, nc);
 }
@@ -427,14 +428,14 @@
   {
     if ( ':' == c)
       {
-	XML_PullParser_closeToken (parser, Prefix);
+	XML_PullParser_closeToken (parser, Prefix, 0);
 	c = XML_PullParser_nextChar (parser, 0);
 	XML_PullParser_openToken (parser);
       }
     else 
       c = XML_PullParser_nextChar (parser, 0);
   }
-  XML_PullParser_closeToken (parser, Name);
+  XML_PullParser_closeToken (parser, Name, 0);
 
   return c;
 }
@@ -453,7 +454,7 @@
 	  c = XML_PullParser_nextChar (parser, 0);
 	  if (quote == c)
 	    {
-	      XML_PullParser_closeToken (parser, AttValue);
+	      XML_PullParser_closeToken (parser, AttValue, 0);
 	      return XML_PullParser_nextChar (parser, 0);
 	    }
 	}
@@ -506,19 +507,24 @@
 XML_PullParser_processCharData (XML_PullParser *parser)
 {
   int c;
+  int ref = 0;
   EVENT = CHARACTER;
   XML_PullParser_openToken (parser);
   do
     {
       c = XML_PullParser_nextChar (parser, -1);
+
+      if (c == '&')
+	ref = 1;
+
       if (c == -1)
 	{
-	XML_PullParser_closeToken (parser, CharData);
+	XML_PullParser_closeToken (parser, CharData, ref);
 	return 0;
 	}
     }
   while (c != '<');
-  XML_PullParser_closeToken (parser, CharData);
+  XML_PullParser_closeToken (parser, CharData, ref);
   return c;
 }
 

Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.h?rev=292082&r1=292081&r2=292082&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/xmlpullparser.h Tue Sep 27 18:42:26
2005
@@ -95,7 +95,7 @@
 PRIVATE int XML_PullParser_processEncodingDecl (XML_PullParser *p);
 PRIVATE int XML_PullParser_processSDDecl (XML_PullParser *p);
 PRIVATE void XML_PullParser_openToken (XML_PullParser *p);
-PRIVATE void XML_PullParser_closeToken (XML_PullParser *p, int t);
+PRIVATE void XML_PullParser_closeToken (XML_PullParser *p, int t, int refer);
 PRIVATE char* XML_PullParser_lastChar (XML_PullParser *p);
 PRIVATE int XML_PullParser_processEq (XML_PullParser *p, int c);
 PRIVATE void XML_PullParser_addAttribute (XML_PullParser *p, TOKEN *name, TOKEN *value);



Mime
View raw message