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 wh...@apache.org on 2005/05/19 14:18:30 UTC

cvs commit: ws-axis/c/src/soap SoapDeSerializer.cpp

whitlock    2005/05/19 05:18:30

  Modified:    c/src/soap SoapDeSerializer.cpp
  Log:
  Make getFaultAsXmlString use getAnyObject
  
  Revision  Changes    Path
  1.163     +11 -65    ws-axis/c/src/soap/SoapDeSerializer.cpp
  
  Index: SoapDeSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.cpp,v
  retrieving revision 1.162
  retrieving revision 1.163
  diff -u -r1.162 -r1.163
  --- SoapDeSerializer.cpp	5 May 2005 08:56:13 -0000	1.162
  +++ SoapDeSerializer.cpp	19 May 2005 12:18:30 -0000	1.163
  @@ -3276,72 +3276,18 @@
   SoapDeSerializer::getFaultAsXMLString()
   {
       if (AXIS_SUCCESS != m_nStatus || RPC_ENCODED == m_nStyle) return NULL;
  -	if (!m_pNode) m_pNode = m_pParser->anyNext ();
  -	if (NULL==m_pNode) return NULL;
  -
  -	string xml;
  -	while (NULL!=m_pNode)
  +	AnyType *any = getAnyObject();
  +	int len = 1, i; // Add 1 for the null terminator
  +	for (i=0; i<any->_size; i++) if (any->_array[i]) len += strlen(any->_array[i]);
  +
  +	xsd__string ret = new char[len];
  +	memset(ret,0,len);
  +	for (i=0; i<any->_size; i++) if (any->_array[i]) 
   	{
  -		if ((0==strcmp("detail",m_pNode->m_pchNameOrValue) || 
  -			 0==strcmp("Fault",m_pNode->m_pchNameOrValue)) && 
  -			 END_ELEMENT==m_pNode->m_type) 
  -			break;
  -
  -		string attrs;
  -		for (int i=0; i<MAX_NO_OF_ATTRIBUTES; i+=3)
  -		{
  -			const char *name = m_pNode->m_pchAttributes[i];
  -			const char *pfx = m_pNode->m_pchAttributes[i+1];
  -			const char *val = m_pNode->m_pchAttributes[i+2];
  -			if (NULL==name) break;
  -			if (0==i) attrs += " ";
  -
  -			if (NULL!=pfx)
  -			{
  -				attrs += pfx;
  -				attrs += ":";
  -			}
  -
  -			attrs += name;
  -			attrs += "=";
  -			if (NULL!=val) attrs += val;
  -			attrs += " ";
  -		}
  -
  -		switch (m_pNode->m_type)
  -		{
  -		case START_ELEMENT:
  -			xml += "<";
  -			xml += m_pNode->m_pchNameOrValue;
  -			if (attrs.size()>0) xml += attrs;
  -			if (END_ELEMENT==m_pNode->m_type2) xml += "/";
  -			xml += ">";
  -			break;
  -
  -		case END_ELEMENT:
  -			xml += "</";
  -			xml += m_pNode->m_pchNameOrValue;
  -			if (attrs.size()>0) xml += attrs;
  -			xml += ">";
  -			break;
  -
  -		case CHARACTER_ELEMENT:
  -			if (attrs.size()>0) xml += attrs;
  -			xml += m_pNode->m_pchNameOrValue;
  -			break;
  -
  -		case START_PREFIX:
  -		case END_PREFIX:
  -		default:
  -			break;
  -		}
  -
  -	    m_pNode = m_pParser->anyNext ();
  -	} // end while
  -
  -	if (0==xml.size()) return NULL;
  -	xsd__string ret = new char[xml.size()+1];
  -	strcpy(ret,xml.c_str());
  +		strcat(ret,any->_array[i]);
  +		delete any->_array[i];
  +	}
  +	delete any;
   	return ret;
   }