Author: nadiramra
Date: Tue Feb 19 06:03:53 2013
New Revision: 1447598
URL: http://svn.apache.org/r1447598
Log:
Simplify code and check for pointer when parsing xsd:any
Modified:
axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp
Modified: axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp?rev=1447598&r1=1447597&r2=1447598&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp (original)
+++ axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp Tue Feb 19 06:03:53 2013
@@ -15,14 +15,6 @@
* limitations under the License.
*/
-/*
- *
- * @author Susantha Kumara ([email protected])
- * @author Damitha Kumarage ([email protected], [email protected])
- * @author Roshan Weerasuriya ([email protected], [email protected])
- * @author Samisa Abeysinghe ([email protected])
- *
- */
// !!! This include file must be first thing in file !!!
#include "../platforms/PlatformAutoSense.hpp"
@@ -1962,6 +1954,9 @@ getFaultAsXMLString()
return NULL;
AnyType *any = getAnyObject();
+ if (any == NULL)
+ return (xsd__string)NULL;
+
int len = 1, i; // Add 1 for the null terminator
for (i=0; i<any->_size; i++)
if (any->_array[i])
@@ -2196,22 +2191,9 @@ getAnyObject (const AxisChar* pName, con
logEntryEngine("SoapDeSerializer::getAnyObject")
// If pname is passed, then we need to move the parser pointer for RPC.
- if (pName != NULL && RPC_ENCODED == m_nStyle)
- {
- m_pNode = m_pParser->anyNext();
- if (m_pNode == NULL)
- {
- logExitWithPointer(NULL)
-
- return (AnyType *)NULL;
- }
- }
-
- // Parser will throw an exception on a parser exception, that is ok...
- if (!m_pNode)
+ if ((pName != NULL && RPC_ENCODED == m_nStyle) || (m_pNode == NULL))
{
- m_pNode = m_pParser->anyNext();
-
+ getNextNode(false, false);
if (m_pNode == NULL)
{
logExitWithPointer(NULL)
@@ -2224,14 +2206,22 @@ getAnyObject (const AxisChar* pName, con
int lstSize = 0;
bool bContinue = true;
bool bElementFound = false;
-
AxisString xmlStr = "";
-
- // There may have been namespace declarations that were previously
processed....get it from
- // the node and reset the node variable.
AxisString nsDecls = "";
+
if (m_pNode)
{
+ // If this is an end-element node, simply return, there is no element
to parse. Note
+ // we do not consume the node.
+ if (END_ELEMENT == m_pNode->m_type)
+ {
+ logExitWithPointer(NULL)
+
+ return (AnyType *)NULL;
+ }
+
+ // There may have been namespace declarations that were previously
processed....get it from
+ // the node and reset the node variable.
nsDecls = ((AnyElement*)m_pNode)->m_strXMLNSDeclsForAnyObject.c_str();
((AnyElement*)m_pNode)->m_strXMLNSDeclsForAnyObject.clear();
}